/** * Construct a JettisonMappedXmlDriver with configuration. This constructor has been added * by special request of Jettison users to support JSON generated by older Jettison * versions. if the driver is setup to ignore the XStream hints for JSON arrays, there is * neither support from XStream's side nor are there any tests to ensure this mode. * * @param config the Jettison configuration * @param useSerializeAsArray flag to use XStream's hints for collections and arrays * @since 1.4 */ public JettisonMappedXmlDriver(final Configuration config, final boolean useSerializeAsArray) { mof = new MappedXMLOutputFactory(config); mif = new MappedXMLInputFactory(config); convention = new MappedNamespaceConvention(config); this.useSerializeAsArray = useSerializeAsArray; }
public MappedDOMDocumentParser(Configuration con) { super(new MappedXMLInputFactory(con)); }
public JettisonMappedXmlDriver() { final HashMap nstjsons = new HashMap(); mof = new MappedXMLOutputFactory(nstjsons); mif = new MappedXMLInputFactory(nstjsons); }
public JsonDataFormat() { final Map<?, ?> nstjsons = new HashMap<>(); mof = new MappedXMLOutputFactory(nstjsons); mif = new MappedXMLInputFactory(nstjsons); }
public XStreamConverter() { this.classMapper = new DefaultClassMapper(); Map nstjsons = new HashMap(); this.outputFactory = new MappedXMLOutputFactory(nstjsons); this.inputFactory = new MappedXMLInputFactory(nstjsons); this.objectMapper = new XStream(); }
public XStreamConverter() { this.classMapper = new DefaultClassMapper(); Map nstjsons = new HashMap(); this.outputFactory = new MappedXMLOutputFactory(nstjsons); this.inputFactory = new MappedXMLInputFactory(nstjsons); this.objectMapper = new XStream(); }
@Override protected AbstractXMLInputFactory getXMLInputFactory() throws XMLStreamException { AxisService service = messageContext.getAxisService(); if (service == null) { throw new XMLStreamException("AxisService not yet set; unable to create namespace map"); } //input factory for "Mapped" convention return new MappedXMLInputFactory(JSONUtil.getNS2JNSMap(service)); } }
@Override protected AbstractXMLInputFactory getXMLInputFactory() throws XMLStreamException { AxisService service = messageContext.getAxisService(); if (service == null) { throw new XMLStreamException("AxisService not yet set; unable to create namespace map"); } //input factory for "Mapped" convention return new MappedXMLInputFactory(JSONUtil.getNS2JNSMap(service)); } }
public JettisonMappedXmlDriver(final Configuration config, final boolean useSerializeAsArray) { mof = new MappedXMLOutputFactory(config); mif = new MappedXMLInputFactory(config); convention = new MappedNamespaceConvention(config); this.useSerializeAsArray = useSerializeAsArray; }
/** * Gives the StAX reader using the "Mapped" formatted input JSON String. * * @return The XMLStreamReader according to the JSON String. * @throws javax.xml.stream.XMLStreamException if there is an error while making the StAX reader. */ public javax.xml.stream.XMLStreamReader getReader() throws javax.xml.stream.XMLStreamException { Map<String, String> nsMap = new HashMap<String, String>(); nsMap.put("", ""); // input factory for "Mapped" convention MappedXMLInputFactory inputFactory = new MappedXMLInputFactory(nsMap); String jsonString = this.getJSONString(); return inputFactory.createXMLStreamReader(new JSONTokener(jsonString)); }
public JettisonMappedXmlDriver() { final HashMap nstjsons = new HashMap(); final Configuration config = new Configuration(nstjsons); mof = new MappedXMLOutputFactory(config); mif = new MappedXMLInputFactory(config); convention = new MappedNamespaceConvention(config); }
/** * Construct a JettisonMappedXmlDriver with configuration. This constructor has been added * by special request of Jettison users to support JSON generated by older Jettison * versions. if the driver is setup to ignore the XStream hints for JSON arrays, there is * neither support from XStream's side nor are there any tests to ensure this mode. * * @param config the Jettison configuration * @param useSerializeAsArray flag to use XStream's hints for collections and arrays * @since 1.4 */ public JettisonMappedXmlDriver(final Configuration config, final boolean useSerializeAsArray) { mof = new MappedXMLOutputFactory(config); mif = new MappedXMLInputFactory(config); convention = new MappedNamespaceConvention(config); this.useSerializeAsArray = useSerializeAsArray; }
public JettisonMappedXmlDriver() { final HashMap nstjsons = new HashMap(); final Configuration config = new Configuration(nstjsons); mof = new MappedXMLOutputFactory(config); mif = new MappedXMLInputFactory(config); convention = new MappedNamespaceConvention(config); }
/** * Construct a JettisonMappedXmlDriver with configuration. This constructor has been added * by special request of Jettison users to support JSON generated by older Jettison * versions. if the driver is setup to ignore the XStream hints for JSON arrays, there is * neither support from XStream's side nor are there any tests to ensure this mode. * * @param config the Jettison configuration * @param useSerializeAsArray flag to use XStream's hints for collections and arrays * @since 1.4 */ public JettisonMappedXmlDriver(final Configuration config, final boolean useSerializeAsArray) { mof = new MappedXMLOutputFactory(config); mif = new MappedXMLInputFactory(config); convention = new MappedNamespaceConvention(config); this.useSerializeAsArray = useSerializeAsArray; }
/** * Construct a JettisonMappedXmlDriver with configuration. This constructor has been added * by special request of Jettison users to support JSON generated by older Jettison * versions. if the driver is setup to ignore the XStream hints for JSON arrays, there is * neither support from XStream's side nor are there any tests to ensure this mode. * * @param config the Jettison configuration * @param useSerializeAsArray flag to use XStream's hints for collections and arrays * @since 1.4 */ public JettisonMappedXmlDriver(final Configuration config, final boolean useSerializeAsArray) { mof = new MappedXMLOutputFactory(config); mif = new MappedXMLInputFactory(config); convention = new MappedNamespaceConvention(config); this.useSerializeAsArray = useSerializeAsArray; }
/** * Construct a JettisonMappedXmlDriver with configuration. This constructor has been added * by special request of Jettison users to support JSON generated by older Jettison * versions. if the driver is setup to ignore the XStream hints for JSON arrays, there is * neither support from XStream's side nor are there any tests to ensure this mode. * * @param config the Jettison configuration * @param useSerializeAsArray flag to use XStream's hints for collections and arrays * @since 1.4 */ public JettisonMappedXmlDriver(final Configuration config, final boolean useSerializeAsArray) { mof = new MappedXMLOutputFactory(config); mif = new MappedXMLInputFactory(config); convention = new MappedNamespaceConvention(config); this.useSerializeAsArray = useSerializeAsArray; }
/** * Construct a JettisonMappedXmlDriver with configuration. This constructor has been added * by special request of Jettison users to support JSON generated by older Jettison * versions. if the driver is setup to ignore the XStream hints for JSON arrays, there is * neither support from XStream's side nor are there any tests to ensure this mode. * * @param config the Jettison configuration * @param useSerializeAsArray flag to use XStream's hints for collections and arrays * @since 1.4 */ public JettisonMappedXmlDriver(final Configuration config, final boolean useSerializeAsArray) { mof = new MappedXMLOutputFactory(config); mif = new MappedXMLInputFactory(config); convention = new MappedNamespaceConvention(config); this.useSerializeAsArray = useSerializeAsArray; }
/** {@inheritDoc} */ @Override public XmlObject readFrom(Class<XmlObject> type, Type genericType, Annotation[] annotations, MediaType m, MultivaluedMap<String, String> headers, InputStream is) throws IOException { XmlObject result = null; try { Map<String, String> nstojns = new HashMap<String, String>(); MappedXMLInputFactory factory = new MappedXMLInputFactory(nstojns); XMLStreamReader xsr = factory.createXMLStreamReader(is); Reader r = (Reader)xsr; result = parseXmlBean(type, r); xsr.close(); } catch (XMLStreamException e) { throw ExceptionUtils.toBadRequestException(e, null); } return result; }
public static XMLStreamReader createStreamReader(InputStream is, boolean readXsiType, ConcurrentHashMap<String, String> namespaceMap, String namespaceSeparator, List<String> primitiveArrayKeys, DocumentDepthProperties depthProps, String enc) throws Exception { if (readXsiType) { namespaceMap.putIfAbsent(XSI_URI, XSI_PREFIX); } Configuration conf = new Configuration(namespaceMap); if (namespaceSeparator != null) { conf.setJsonNamespaceSeparator(namespaceSeparator); } if (primitiveArrayKeys != null) { conf.setPrimitiveArrayKeys( new HashSet<>(primitiveArrayKeys)); } XMLInputFactory factory = depthProps != null ? new JettisonMappedReaderFactory(conf, depthProps) : new MappedXMLInputFactory(conf); return new JettisonReader(namespaceMap, factory.createXMLStreamReader(is, enc)); }
/** * Construct a JettisonMappedXmlDriver with configuration. * <p> * This constructor has been added by special request of Jettison users to support JSON generated by older Jettison * versions. if the driver is setup to ignore the XStream hints for JSON arrays, there is neither support from * XStream's side nor are there any tests to ensure this mode. * </p> * * @param config the Jettison configuration * @param useSerializeAsArray flag to use XStream's hints for collections and arrays * @since 1.4 */ public JettisonMappedXmlDriver(Configuration config, final boolean useSerializeAsArray) { config = config == null ? new Configuration() : config; mof = new MappedXMLOutputFactory(config); mif = new MappedXMLInputFactory(config); convention = new MappedNamespaceConvention(config); this.useSerializeAsArray = useSerializeAsArray; }