Class JsonXMLStreamReader

  • All Implemented Interfaces:
    XMLStreamConstants, XMLStreamReader

    public class JsonXMLStreamReader
    extends AbstractXMLStreamReader<org.apache.synapse.commons.staxon.core.json.JsonXMLStreamReader.ScopeInfo>
    JSON XML stream reader.

    Limitations

    • Mixed content (e.g. <alice>bob<edgar/></alice>) is not supported.

    The reader may produce processing instructions <?xml-multiple element-name?> to indicate array starts ('[').

    • Constructor Detail

      • JsonXMLStreamReader

        public JsonXMLStreamReader​(JsonStreamSource source,
                                   boolean multiplePI,
                                   char namespaceSeparator)
                            throws XMLStreamException
        Create reader instance.
        Parameters:
        source - stream source
        multiplePI - whether to produce <xml-multiple?> PIs to signal array start
        namespaceSeparator - namespace prefix separator
        Throws:
        XMLStreamException
      • JsonXMLStreamReader

        public JsonXMLStreamReader​(JsonStreamSource source,
                                   boolean multiplePI,
                                   char namespaceSeparator,
                                   boolean xmlNilReadWriteEnabled)
                            throws XMLStreamException
        Create reader instance.
        Parameters:
        source - stream source
        multiplePI - whether to produce <xml-multiple?> PIs to signal array start
        namespaceSeparator - namespace prefix separator
        xmlNilReadWriteEnabled - Supports reading and writing of XML Nil elements as defined by http://www.w3.org/TR/xmlschema-1/#xsi_nil when the XML/JSON inputs contains nil/null values.
        Throws:
        XMLStreamException
    • Method Detail

      • consume

        protected boolean consume()
                           throws XMLStreamException,
                                  IOException
        Description copied from class: AbstractXMLStreamReader
        Main method to be implemented by subclasses. This method is called by the reader when the event queue runs dry. Consume some events and delegate to the various readXXX() methods. When encountering an element start event, all attributes and namespace delarations must be consumed too, otherwise these won't be available during start element.
        Specified by:
        consume in class AbstractXMLStreamReader<org.apache.synapse.commons.staxon.core.json.JsonXMLStreamReader.ScopeInfo>
        Returns:
        true if there's more to read
        Throws:
        XMLStreamException
        IOException
      • hasNumber

        public boolean hasNumber()
        Returns:
        true iff the current event data is a number primitive
      • hasBoolean

        public boolean hasBoolean()
        Returns:
        true iff the current event data is a boolean primitive