de.odysseus.staxon.json
Class JsonXMLInputFactory

java.lang.Object
  extended by javax.xml.stream.XMLInputFactory
      extended by de.odysseus.staxon.base.AbstractXMLInputFactory
          extended by de.odysseus.staxon.json.JsonXMLInputFactory

public class JsonXMLInputFactory
extends AbstractXMLInputFactory

XML input factory for streaming from JSON.


Field Summary
static String PROP_MULTIPLE_PI
          Whether to use the JsonXMLStreamConstants.MULTIPLE_PI_TARGET processing instruction to indicate an array start.
static String PROP_NAMESPACE_SEPARATOR
          Namespace prefix separator.
static String PROP_VIRTUAL_ROOT
          JSON documents may have have multiple root properties.
 
Fields inherited from class javax.xml.stream.XMLInputFactory
ALLOCATOR, IS_COALESCING, IS_NAMESPACE_AWARE, IS_REPLACING_ENTITY_REFERENCES, IS_SUPPORTING_EXTERNAL_ENTITIES, IS_VALIDATING, REPORTER, RESOLVER, SUPPORT_DTD
 
Constructor Summary
JsonXMLInputFactory()
           
JsonXMLInputFactory(JsonStreamFactory streamFactory)
           
JsonXMLInputFactory(JsonXMLConfig config)
           
JsonXMLInputFactory(JsonXMLConfig config, JsonStreamFactory streamFactory)
           
 
Method Summary
 XMLEventReader createFilteredReader(XMLEventReader reader, EventFilter filter)
           
 XMLEventReader createXMLEventReader(XMLStreamReader reader)
           
 JsonXMLStreamReader createXMLStreamReader(InputStream stream)
           
 JsonXMLStreamReader createXMLStreamReader(InputStream stream, String encoding)
           
 JsonXMLStreamReader createXMLStreamReader(Reader reader)
           
 JsonXMLStreamReader createXMLStreamReader(String systemId, InputStream stream)
           
 JsonXMLStreamReader createXMLStreamReader(String systemId, Reader reader)
           
 Object getProperty(String name)
           
 boolean isPropertySupported(String name)
           
 void setProperty(String name, Object value)
           
 void setXMLReporter(XMLReporter reporter)
           
 void setXMLResolver(XMLResolver resolver)
           
 
Methods inherited from class de.odysseus.staxon.base.AbstractXMLInputFactory
createFilteredReader, createXMLEventReader, createXMLEventReader, createXMLEventReader, createXMLEventReader, createXMLEventReader, createXMLEventReader, createXMLStreamReader, getEventAllocator, getXMLReporter, getXMLResolver, setEventAllocator
 
Methods inherited from class javax.xml.stream.XMLInputFactory
newFactory, newFactory, newInstance, newInstance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROP_MULTIPLE_PI

public static final String PROP_MULTIPLE_PI

Whether to use the JsonXMLStreamConstants.MULTIPLE_PI_TARGET processing instruction to indicate an array start. If true, this reader will insert a PI with the field name as PI data.

Note that the element given in the PI may occur zero times, indicating an "empty array".

The default value is true.

See Also:
Constant Field Values

PROP_VIRTUAL_ROOT

public static final String PROP_VIRTUAL_ROOT

JSON documents may have have multiple root properties. However, XML requires a single root element. This property takes the name of a "virtual" root element, which will be added to the stream when reading.

The default value is null.

See Also:
Constant Field Values

PROP_NAMESPACE_SEPARATOR

public static final String PROP_NAMESPACE_SEPARATOR

Namespace prefix separator.

The default value is ':'.

See Also:
Constant Field Values
Constructor Detail

JsonXMLInputFactory

public JsonXMLInputFactory()
                    throws FactoryConfigurationError
Throws:
FactoryConfigurationError

JsonXMLInputFactory

public JsonXMLInputFactory(JsonStreamFactory streamFactory)

JsonXMLInputFactory

public JsonXMLInputFactory(JsonXMLConfig config)
                    throws FactoryConfigurationError
Throws:
FactoryConfigurationError

JsonXMLInputFactory

public JsonXMLInputFactory(JsonXMLConfig config,
                           JsonStreamFactory streamFactory)
Method Detail

createXMLStreamReader

public JsonXMLStreamReader createXMLStreamReader(InputStream stream,
                                                 String encoding)
                                          throws XMLStreamException
Specified by:
createXMLStreamReader in class XMLInputFactory
Throws:
XMLStreamException

createXMLStreamReader

public JsonXMLStreamReader createXMLStreamReader(String systemId,
                                                 InputStream stream)
                                          throws XMLStreamException
Specified by:
createXMLStreamReader in class XMLInputFactory
Throws:
XMLStreamException

createXMLStreamReader

public JsonXMLStreamReader createXMLStreamReader(String systemId,
                                                 Reader reader)
                                          throws XMLStreamException
Specified by:
createXMLStreamReader in class XMLInputFactory
Throws:
XMLStreamException

createXMLStreamReader

public JsonXMLStreamReader createXMLStreamReader(Reader reader)
                                          throws XMLStreamException
Specified by:
createXMLStreamReader in class XMLInputFactory
Throws:
XMLStreamException

createXMLStreamReader

public JsonXMLStreamReader createXMLStreamReader(InputStream stream)
                                          throws XMLStreamException
Specified by:
createXMLStreamReader in class XMLInputFactory
Throws:
XMLStreamException

createXMLEventReader

public XMLEventReader createXMLEventReader(XMLStreamReader reader)
                                    throws XMLStreamException
Specified by:
createXMLEventReader in class XMLInputFactory
Throws:
XMLStreamException

createFilteredReader

public XMLEventReader createFilteredReader(XMLEventReader reader,
                                           EventFilter filter)
                                    throws XMLStreamException
Specified by:
createFilteredReader in class XMLInputFactory
Throws:
XMLStreamException

setXMLResolver

public void setXMLResolver(XMLResolver resolver)
Overrides:
setXMLResolver in class AbstractXMLInputFactory

setXMLReporter

public void setXMLReporter(XMLReporter reporter)
Overrides:
setXMLReporter in class AbstractXMLInputFactory

isPropertySupported

public boolean isPropertySupported(String name)
Overrides:
isPropertySupported in class AbstractXMLInputFactory

getProperty

public Object getProperty(String name)
                   throws IllegalArgumentException
Overrides:
getProperty in class AbstractXMLInputFactory
Throws:
IllegalArgumentException

setProperty

public void setProperty(String name,
                        Object value)
                 throws IllegalArgumentException
Overrides:
setProperty in class AbstractXMLInputFactory
Throws:
IllegalArgumentException


Copyright © 2011-2012. All Rights Reserved.