Package org.codehaus.jettison.mapped

Examples of org.codehaus.jettison.mapped.MappedNamespaceConvention


                } catch (XMLStreamException ex) {
                    throw new RuntimeException(ex);
                }
                callback = null; // this doesn't make sense
            } else if (mediaType == MediaType.APPLICATION_JSON) {
                xml = new MappedXMLStreamWriter(new MappedNamespaceConvention(), writer);
            } else {
                throw new RuntimeException("mediatype not handled " + mediaType);
            }
            return xml;
        }
View Full Code Here


   }

   public JettisonMappedContext(Map<String, String> xmlnsToJson, List<QName> attributesAsElements, List<QName> ignoredElements, Class... classes)
   {
      Configuration config = new Configuration(xmlnsToJson, attributesAsElements, ignoredElements);
      convention = new MappedNamespaceConvention(config);

      try
      {
         context = JAXBContext.newInstance(classes);
      }
View Full Code Here

   public JettisonMappedUnmarshaller(JAXBContext context, Map<String, String> xmlToJSON, List<String> attributeMapping, List<String> ignoredElements) throws JAXBException
   {
      unmarshaller = context.createUnmarshaller();
      Configuration config = new Configuration(xmlToJSON, attributeMapping, ignoredElements);
      convention = new MappedNamespaceConvention(config);
   }
View Full Code Here

      Configuration config = new Configuration();
      Map<String, String> xmlToJsonNamespaces = new HashMap<String,String>(1);
      xmlToJsonNamespaces.put("http://www.example.org/b/Test", "test");
      xmlToJsonNamespaces.put("http://www.example.org/a/TestCanonical", "can");
      config.setXmlToJsonNamespaces(xmlToJsonNamespaces);
      MappedNamespaceConvention con = new MappedNamespaceConvention(config);
      StringWriter writer = new StringWriter();
      XMLStreamWriter xmlStreamWriter = new MappedXMLStreamWriter(con, writer);

      Marshaller marshaller = jc.createMarshaller();
      marshaller.marshal(JAXBXmlTypeProvider.wrapInJAXBElement(result, TestExtends.class), xmlStreamWriter);
View Full Code Here

      Configuration config = new Configuration();
      Map<String, String> xmlToJsonNamespaces = new HashMap<String,String>(1);
      xmlToJsonNamespaces.put("http://www.example.org/b/Test", "test");
      xmlToJsonNamespaces.put("http://www.example.org/a/TestCanonical", "can");
      config.setXmlToJsonNamespaces(xmlToJsonNamespaces);
      MappedNamespaceConvention con = new MappedNamespaceConvention(config);
      XMLStreamReader xmlStreamReader = new MappedXMLStreamReader(new JSONObject(output), con);

      Unmarshaller unmarshaller = jc.createUnmarshaller();
      JAXBElement<TestExtends> val = (JAXBElement<TestExtends>)unmarshaller.unmarshal(xmlStreamReader);
      return val.getValue();
View Full Code Here

   public JettisonMappedMarshaller(JAXBContext context, Map<String, String> xmlToJSON, List<String> attributeMapping, List<String> ignoredElements) throws JAXBException
   {
      marshaller = context.createMarshaller();
      Configuration config = new Configuration(xmlToJSON, attributeMapping, ignoredElements);
      convention = new MappedNamespaceConvention(config);
   }
View Full Code Here

   }

   public JettisonMappedContext(Map<String, String> xmlnsToJson, List<QName> attributesAsElements, List<QName> ignoredElements, Class... classes)
   {
      Configuration config = new Configuration(xmlnsToJson, attributesAsElements, ignoredElements);
      convention = new MappedNamespaceConvention(config);

      try
      {
         context = JAXBContext.newInstance(classes);
      }
View Full Code Here

                                                     boolean writeXsiType,
                                                     Configuration config,
                                                     boolean serializeAsArray,
                                                     List<String> arrayKeys,
                                                     boolean dropRootElement) throws Exception {
        MappedNamespaceConvention convention = new MappedNamespaceConvention(config);
        AbstractXMLStreamWriter xsw = new MappedXMLStreamWriter(
                                            convention,
                                            new OutputStreamWriter(os, UTF8));
        if (serializeAsArray) {
            if (arrayKeys != null) {
View Full Code Here

                                                     boolean serializeAsArray,
                                                     List<String> arrayKeys,
                                                     boolean dropRootElement,
                                                     String enc) throws Exception {
    //CHECKSTYLE:ON   
        MappedNamespaceConvention convention = new MappedNamespaceConvention(config);
        AbstractXMLStreamWriter xsw = new MappedXMLStreamWriter(
                                            convention,
                                            new OutputStreamWriter(os, enc));
        if (serializeAsArray) {
            if (arrayKeys != null) {
View Full Code Here

                if (null == config.getXml2JsonNs()) {
                    jmConfig = new Configuration();
                } else {
                    jmConfig = new Configuration(config.getXml2JsonNs());
                }
                return new MappedXMLStreamWriter(new MappedNamespaceConvention(jmConfig), writer);
            default:
                return null;
        }
    }
View Full Code Here

TOP

Related Classes of org.codehaus.jettison.mapped.MappedNamespaceConvention

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.