Class StreamReaderBufferCreator


public class StreamReaderBufferCreator extends AbstractCreator
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 Details

    • attributeValuePrefixes

      protected List<String> attributeValuePrefixes
  • Constructor Details

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

    • create

      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:
      XMLStreamException - if the stream reader is not positioned at the start of the document or at an element.
    • createElementFragment

      public MutableXMLStreamBuffer createElementFragment(XMLStreamReader reader, boolean storeInScopeNamespaces) throws 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:
      XMLStreamException - if the stream reader cannot be positioned at the start of an element.
    • storeElement

      public void storeElement(String nsURI, String localName, String prefix, 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
      
        <S:Envelope xmlns:n1=".."><S:Body><ns2:A> ...
       
      when xsb is to be created using a reader that is at <ns2:A> 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).
    • storeQualifiedName

      protected void storeQualifiedName(int item, String prefix, String uri, String localName)
    • storeNamespaceAttribute

      protected final void storeNamespaceAttribute(String prefix, String uri)
    • storeAttribute

      protected final void storeAttribute(String prefix, String uri, String localName, String type, String value)
    • getAttributeValuePrefixes

      public final List<String> getAttributeValuePrefixes()
    • storeProcessingInstruction

      protected final void storeProcessingInstruction(String target, String data)
    • isCheckAttributeValue

      public final boolean isCheckAttributeValue()
    • setCheckAttributeValue

      public final void setCheckAttributeValue(boolean value)