Class StreamReaderBufferCreator


  • public class StreamReaderBufferCreator
    extends StreamBufferCreator
    Create a buffer using an XMLStreamReader.

    TODO: Implement the marking the stream on the element when an ID attribute on the element is defined

    • Field Detail

      • _eventType

        private int _eventType
      • _storeInScopeNamespacesOnElementFragment

        private boolean _storeInScopeNamespacesOnElementFragment
      • _inScopePrefixes

        private java.util.Map<java.lang.String,​java.lang.Integer> _inScopePrefixes
    • Constructor Detail

      • StreamReaderBufferCreator

        public StreamReaderBufferCreator()
        Create a stream reader buffer creator.

        A stream buffer will be created for storing the infoset from a stream reader.

      • StreamReaderBufferCreator

        public StreamReaderBufferCreator​(MutableXMLStreamBuffer buffer)
        Create a stream reader buffer creator using a mutable stream buffer.

        Parameters:
        buffer - the mutable stream buffer.
    • Method Detail

      • create

        public MutableXMLStreamBuffer create​(javax.xml.stream.XMLStreamReader reader)
                                      throws javax.xml.stream.XMLStreamException
        Create the buffer from a stream reader.

        The stream reader must be positioned at the start of the document or the start of an element.

        If the stream is positioned at the start of the document then the whole document is stored and after storing the stream will be positioned at the end of the document.

        If the stream is positioned at the start of an element then the element and all its children will be stored and after storing the stream will be positioned at the next event after the end of the element.

        Returns:
        the mutable stream buffer.
        Throws:
        javax.xml.stream.XMLStreamException - if the stream reader is not positioned at the start of the document or at an element.
      • createElementFragment

        public MutableXMLStreamBuffer createElementFragment​(javax.xml.stream.XMLStreamReader reader,
                                                            boolean storeInScopeNamespaces)
                                                     throws javax.xml.stream.XMLStreamException
        Creates the buffer from a stream reader that is an element fragment.

        The stream reader will be moved to the position of the next start of an element if the stream reader is not already positioned at the start of an element.

        The element and all its children will be stored and after storing the stream will be positioned at the next event after the end of the element.

        Parameters:
        storeInScopeNamespaces - true if in-scope namespaces of the element fragment should be stored.
        Returns:
        the mutable stream buffer.
        Throws:
        javax.xml.stream.XMLStreamException - if the stream reader cannot be positioned at the start of an element.
      • store

        private void store​(javax.xml.stream.XMLStreamReader reader)
                    throws javax.xml.stream.XMLStreamException
        Throws:
        javax.xml.stream.XMLStreamException
      • storeDocumentAndChildren

        private void storeDocumentAndChildren​(javax.xml.stream.XMLStreamReader reader)
                                       throws javax.xml.stream.XMLStreamException
        Throws:
        javax.xml.stream.XMLStreamException
      • storeElementAndChildren

        private void storeElementAndChildren​(javax.xml.stream.XMLStreamReader reader)
                                      throws javax.xml.stream.XMLStreamException
        Throws:
        javax.xml.stream.XMLStreamException
      • storeElementAndChildrenEx

        private void storeElementAndChildrenEx​(org.jvnet.staxex.XMLStreamReaderEx reader)
                                        throws javax.xml.stream.XMLStreamException
        Throws:
        javax.xml.stream.XMLStreamException
      • storeElementAndChildrenNoEx

        private void storeElementAndChildrenNoEx​(javax.xml.stream.XMLStreamReader reader)
                                          throws javax.xml.stream.XMLStreamException
        Throws:
        javax.xml.stream.XMLStreamException
      • storeElementWithInScopeNamespaces

        private void storeElementWithInScopeNamespaces​(javax.xml.stream.XMLStreamReader reader)
      • storeElement

        private void storeElement​(javax.xml.stream.XMLStreamReader reader)
      • storeElement

        public void storeElement​(java.lang.String nsURI,
                                 java.lang.String localName,
                                 java.lang.String prefix,
                                 java.lang.String[] ns)
        A low level method a create a structure element explicitly. This is useful when xsb is created from a fragment's XMLStreamReader and inscope namespaces can be passed using this method. Note that there is no way to enumerate namespaces from XMLStreamReader. For e.g: Say the SOAP message is as follows ... when xsb is to be created using a reader that is at tag, the inscope namespace like 'n1' can be passed using this method. WARNING: Instead of using this, try other methods(if you don't know what you are doing).
        Parameters:
        ns - an array of the even length of the form { prefix0, uri0, prefix1, uri1, ... }.
      • storeEndElement

        public void storeEndElement()
        A low level method a create a structure element explicitly. This is required to support storeElement(javax.xml.stream.XMLStreamReader) method. WARNING: Instead of using this, try other methods(if you don't know what you are doing).
      • storeNamespaceAttributes

        private void storeNamespaceAttributes​(javax.xml.stream.XMLStreamReader reader)
      • storeNamespaceAttributes

        private void storeNamespaceAttributes​(java.lang.String[] ns)
        Parameters:
        ns - an array of the even length of the form { prefix0, uri0, prefix1, uri1, ... }.
      • storeAttributes

        private void storeAttributes​(javax.xml.stream.XMLStreamReader reader)
      • storeComment

        private void storeComment​(javax.xml.stream.XMLStreamReader reader)
      • storeProcessingInstruction

        private void storeProcessingInstruction​(javax.xml.stream.XMLStreamReader reader)