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

## Class JsonXMLOutputFactory

- java.lang.Object
- - javax.xml.stream.XMLOutputFactory
  - - org.apache.synapse.commons.staxon.core.base.AbstractXMLOutputFactory
    - - org.apache.synapse.commons.staxon.core.json.JsonXMLOutputFactory

-     public class JsonXMLOutputFactory
      extends AbstractXMLOutputFactory

  XML output factory for streaming to JSON.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `PROP_AUTO_ARRAY` Start/end arrays automatically?
    `static java.lang.String` | `PROP_AUTO_PRIMITIVE` Convert element text to JSON primitives (number, boolean, null) automatically?
    `static java.lang.String` | `PROP_CUSTOM_REGEX` Convert element text to JSON primitives with ignore given regex (number, boolean, null) automatically?
    `static java.lang.String` | `PROP_CUSTOM_REPLACE_REGEX`
    `static java.lang.String` | `PROP_CUSTOM_REPLACE_SEQUENCE`
    `static java.lang.String` | `PROP_MULTIPLE_PI` Whether to use the `JsonXMLStreamConstants.MULTIPLE_PI_TARGET` processing instruction target to trigger an array start.
    `static java.lang.String` | `PROP_NAMESPACE_DECLARATIONS` Whether to write namespace declarations.
    `static java.lang.String` | `PROP_NAMESPACE_SEPARATOR` Namespace prefix separator.
    `static java.lang.String` | `PROP_PRETTY_PRINT` Format output for better readability?
    `static java.lang.String` | `PROP_VIRTUAL_ROOT` JSON documents may have have multiple root properties.

    - ### Fields inherited from class javax.xml.stream.XMLOutputFactory

      `IS_REPAIRING_NAMESPACES`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `JsonXMLOutputFactory()`
    `JsonXMLOutputFactory(JsonStreamFactory streamFactory)`
    `JsonXMLOutputFactory(JsonXMLConfig config)`
    `JsonXMLOutputFactory(JsonXMLConfig config, JsonStreamFactory streamFactory)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `javax.xml.stream.XMLEventWriter` | `createXMLEventWriter(javax.xml.stream.XMLStreamWriter writer)`
    `JsonXMLStreamWriter` | `createXMLStreamWriter(java.io.OutputStream stream)`
    `JsonXMLStreamWriter` | `createXMLStreamWriter(java.io.OutputStream stream, java.lang.String encoding)`
    `JsonXMLStreamWriter` | `createXMLStreamWriter(java.io.Writer stream)`
    `JsonXMLConfig` | `getConfig()`
    `java.lang.Object` | `getProperty(java.lang.String name)`
    `boolean` | `isPropertySupported(java.lang.String name)`
    `void` | `setProperty(java.lang.String name, java.lang.Object value)`

    - ### Methods inherited from class org.apache.synapse.commons.staxon.core.base.AbstractXMLOutputFactory

      `createXMLEventWriter, createXMLEventWriter, createXMLEventWriter, createXMLEventWriter, createXMLStreamWriter`

    - ### Methods inherited from class javax.xml.stream.XMLOutputFactory

      `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_AUTO_ARRAY

          public static final java.lang.String PROP_AUTO_ARRAY

      Start/end arrays automatically?

      The default value is `false`.

      See Also:
        Constant Field Values

    - #### PROP_AUTO_PRIMITIVE

          public static final java.lang.String PROP_AUTO_PRIMITIVE

      Convert element text to JSON primitives (number, boolean, null) automatically?

      The default value is `false`.

      See Also:
        Constant Field Values

    - #### PROP_MULTIPLE_PI

          public static final java.lang.String PROP_MULTIPLE_PI

      Whether to use the `JsonXMLStreamConstants.MULTIPLE_PI_TARGET` processing instruction target to trigger an array start. If `true`, a PI is used to inform the writer to begin an array, passing the name of following multiple elements as data. The writer will close arrays automatically.

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

      The default value is true.

      See Also:
        Constant Field Values

    - #### PROP_VIRTUAL_ROOT

          public static final java.lang.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 removed from the stream when writing.

      The default value is `null`.

      See Also:
        Constant Field Values

    - #### PROP_NAMESPACE_SEPARATOR

          public static final java.lang.String PROP_NAMESPACE_SEPARATOR

      Namespace prefix separator.

      The default value is `':'`.

      See Also:
        Constant Field Values

    - #### PROP_NAMESPACE_DECLARATIONS

          public static final java.lang.String PROP_NAMESPACE_DECLARATIONS

      Whether to write namespace declarations.

      The default value is `true`.

      See Also:
        Constant Field Values

    - #### PROP_PRETTY_PRINT

          public static final java.lang.String PROP_PRETTY_PRINT

      Format output for better readability?

      The default value is `false`.

      See Also:
        Constant Field Values

    - #### PROP_CUSTOM_REGEX

          public static final java.lang.String PROP_CUSTOM_REGEX

      Convert element text to JSON primitives with ignore given regex (number, boolean, null) automatically?

      The default value is `null`.

      See Also:
        Constant Field Values

    - #### PROP_CUSTOM_REPLACE_REGEX

          public static final java.lang.String PROP_CUSTOM_REPLACE_REGEX

      See Also:
        Constant Field Values

    - #### PROP_CUSTOM_REPLACE_SEQUENCE

          public static final java.lang.String PROP_CUSTOM_REPLACE_SEQUENCE

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### JsonXMLOutputFactory

          public JsonXMLOutputFactory()
                               throws javax.xml.stream.FactoryConfigurationError

      Throws:
        `javax.xml.stream.FactoryConfigurationError`

    - #### JsonXMLOutputFactory

          public JsonXMLOutputFactory(JsonStreamFactory streamFactory)

    - #### JsonXMLOutputFactory

          public JsonXMLOutputFactory(JsonXMLConfig config)
                               throws javax.xml.stream.FactoryConfigurationError

      Throws:
        `javax.xml.stream.FactoryConfigurationError`

    - #### JsonXMLOutputFactory

          public JsonXMLOutputFactory(JsonXMLConfig config,
                                      JsonStreamFactory streamFactory)

  - ### Method Detail

    - #### createXMLStreamWriter

          public JsonXMLStreamWriter createXMLStreamWriter(java.io.OutputStream stream,
                                                           java.lang.String encoding)
                                                    throws javax.xml.stream.XMLStreamException

      Specified by:
        `createXMLStreamWriter` in class `javax.xml.stream.XMLOutputFactory`
      Throws:
        `javax.xml.stream.XMLStreamException`

    - #### createXMLStreamWriter

          public JsonXMLStreamWriter createXMLStreamWriter(java.io.Writer stream)
                                                    throws javax.xml.stream.XMLStreamException

      Specified by:
        `createXMLStreamWriter` in class `javax.xml.stream.XMLOutputFactory`
      Throws:
        `javax.xml.stream.XMLStreamException`

    - #### createXMLStreamWriter

          public JsonXMLStreamWriter createXMLStreamWriter(java.io.OutputStream stream)
                                                    throws javax.xml.stream.XMLStreamException

      Specified by:
        `createXMLStreamWriter` in class `javax.xml.stream.XMLOutputFactory`
      Throws:
        `javax.xml.stream.XMLStreamException`

    - #### createXMLEventWriter

          public javax.xml.stream.XMLEventWriter createXMLEventWriter(javax.xml.stream.XMLStreamWriter writer)
                                                               throws javax.xml.stream.XMLStreamException

      Specified by:
        `createXMLEventWriter` in class `AbstractXMLOutputFactory`
      Throws:
        `javax.xml.stream.XMLStreamException`

    - #### isPropertySupported

          public boolean isPropertySupported(java.lang.String name)

      Overrides:
        `isPropertySupported` in class `AbstractXMLOutputFactory`

    - #### getProperty

          public java.lang.Object getProperty(java.lang.String name)
                                       throws java.lang.IllegalArgumentException

      Overrides:
        `getProperty` in class `AbstractXMLOutputFactory`
      Throws:
        `java.lang.IllegalArgumentException`

    - #### setProperty

          public void setProperty(java.lang.String name,
                                  java.lang.Object value)
                           throws java.lang.IllegalArgumentException

      Overrides:
        `setProperty` in class `AbstractXMLOutputFactory`
      Throws:
        `java.lang.IllegalArgumentException`

    - #### getConfig

          public JsonXMLConfig getConfig()

Copyright © 2005-2021 Apache Software Foundation. All Rights Reserved.