Package org.apache.synapse.commons.staxon.core.json

# Class JsonXMLInputFactory

java.lang.Object
javax.xml.stream.XMLInputFactory
org.apache.synapse.commons.staxon.core.base.AbstractXMLInputFactory
org.apache.synapse.commons.staxon.core.json.JsonXMLInputFactory

public class JsonXMLInputFactory extends AbstractXMLInputFactory
XML input factory for streaming from JSON.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `PROP_MULTIPLE_PI`
  Whether to use the `JsonXMLStreamConstants.MULTIPLE_PI_TARGET` processing instruction to indicate an array start.
  `static final String`
  `PROP_NAMESPACE_SEPARATOR`
  Namespace prefix separator.
  `static final 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

  Constructors
  Constructor
  Description
  `JsonXMLInputFactory()`
  `JsonXMLInputFactory(JsonXMLConfig config)`
  `JsonXMLInputFactory(JsonXMLConfig config, JsonStreamFactory streamFactory)`
  `JsonXMLInputFactory(JsonStreamFactory streamFactory)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `XMLEventReader`
  `createFilteredReader(XMLEventReader reader, EventFilter filter)`
  `XMLEventReader`
  `createXMLEventReader(XMLStreamReader reader)`
  `JsonXMLStreamReader`
  `createXMLStreamReader(InputStream stream)`
  `JsonXMLStreamReader`
  `createXMLStreamReader(InputStream stream, String encoding)`
  `JsonXMLStreamReader`
  `createXMLStreamReader(InputStream stream, Constants.SCANNER scanner)`
  `JsonXMLStreamReader`
  `createXMLStreamReader(Reader reader)`
  `JsonXMLStreamReader`
  `createXMLStreamReader(Reader reader, Constants.SCANNER scanner)`
  `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 org.apache.synapse.commons.staxon.core.base.AbstractXMLInputFactory

  `createFilteredReader, createXMLEventReader, createXMLEventReader, createXMLEventReader, createXMLEventReader, createXMLEventReader, createXMLEventReader, createXMLStreamReader, getEventAllocator, getXMLReporter, getXMLResolver, setEventAllocator`

  ### Methods inherited from class javax.xml.stream.XMLInputFactory

  `newDefaultFactory, newFactory, newFactory, newInstance, newInstance`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### 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 Details

  - ### 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 Details

  - ### 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(Reader reader, Constants.SCANNER scanner) throws XMLStreamException
    Throws:
      `XMLStreamException`

  - ### createXMLStreamReader

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

  - ### createXMLStreamReader

    public JsonXMLStreamReader createXMLStreamReader(InputStream stream, Constants.SCANNER scanner) throws XMLStreamException
    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`