Class StreamReaderBufferCreator
- java.lang.Object
-
- com.sun.xml.stream.buffer.AbstractCreatorProcessor
-
- com.sun.xml.stream.buffer.AbstractCreator
-
- com.sun.xml.stream.buffer.stax.StreamReaderBufferCreator
-
public class StreamReaderBufferCreator extends AbstractCreator
Create a buffer using anXMLStreamReader
.TODO: Implement the marking the stream on the element when an ID attribute on the element is defined
-
-
Field Summary
Fields Modifier and Type Field Description protected List<String>
attributeValuePrefixes
-
Fields inherited from class com.sun.xml.stream.buffer.AbstractCreator
_buffer
-
Fields inherited from class com.sun.xml.stream.buffer.AbstractCreatorProcessor
_contentCharactersBuffer, _contentCharactersBufferPtr, _contentObjects, _contentObjectsPtr, _currentContentCharactersBufferFragment, _currentContentObjectFragment, _currentStructureFragment, _currentStructureStringFragment, _structure, _structurePtr, _structureStrings, _structureStringsPtr, CHAR_ARRAY_LENGTH_MEDIUM, CHAR_ARRAY_LENGTH_MEDIUM_SIZE, CHAR_ARRAY_LENGTH_SMALL, CHAR_ARRAY_LENGTH_SMALL_SIZE, CONTENT_TYPE_CHAR_ARRAY, CONTENT_TYPE_CHAR_ARRAY_COPY, CONTENT_TYPE_OBJECT, CONTENT_TYPE_STRING, FLAG_DOCUMENT_FRAGMENT, FLAG_PREFIX, FLAG_QUALIFIED_NAME, FLAG_URI, T_ATTRIBUTE, T_ATTRIBUTE_LN, T_ATTRIBUTE_LN_OBJECT, T_ATTRIBUTE_P_U_LN, T_ATTRIBUTE_P_U_LN_OBJECT, T_ATTRIBUTE_U_LN, T_ATTRIBUTE_U_LN_OBJECT, T_ATTRIBUTE_U_LN_QN, T_ATTRIBUTE_U_LN_QN_OBJECT, T_COMMENT, T_COMMENT_AS_CHAR_ARRAY, T_COMMENT_AS_CHAR_ARRAY_COPY, T_COMMENT_AS_CHAR_ARRAY_MEDIUM, T_COMMENT_AS_CHAR_ARRAY_SMALL, T_COMMENT_AS_STRING, T_DOCUMENT, T_DOCUMENT_FRAGMENT, T_ELEMENT, T_ELEMENT_LN, T_ELEMENT_P_U_LN, T_ELEMENT_U_LN, T_ELEMENT_U_LN_QN, T_END, T_END_OF_BUFFER, T_NAMESPACE_ATTRIBUTE, T_NAMESPACE_ATTRIBUTE_P, T_NAMESPACE_ATTRIBUTE_P_U, T_NAMESPACE_ATTRIBUTE_U, T_PROCESSING_INSTRUCTION, T_TEXT, T_TEXT_AS_CHAR_ARRAY, T_TEXT_AS_CHAR_ARRAY_COPY, T_TEXT_AS_CHAR_ARRAY_MEDIUM, T_TEXT_AS_CHAR_ARRAY_SMALL, T_TEXT_AS_OBJECT, T_TEXT_AS_STRING, T_UNEXPANDED_ENTITY_REFERENCE, TYPE_MASK, VALUE_TYPE_OBJECT, VALUE_TYPE_STRING
-
-
Constructor Summary
Constructors Constructor Description StreamReaderBufferCreator()
Create a stream reader buffer creator.StreamReaderBufferCreator(MutableXMLStreamBuffer buffer)
Create a stream reader buffer creator using a mutable stream buffer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MutableXMLStreamBuffer
create(XMLStreamReader reader)
Create the buffer from a stream reader.MutableXMLStreamBuffer
createElementFragment(XMLStreamReader reader, boolean storeInScopeNamespaces)
Creates the buffer from a stream reader that is an element fragment.List
getAttributeValuePrefixes()
boolean
isCheckAttributeValue()
void
setCheckAttributeValue(boolean value)
protected void
storeAttribute(String prefix, String uri, String localName, String type, String value)
void
storeElement(String nsURI, String localName, String prefix, String[] ns)
A low level method a create a structure element explicitly.void
storeEndElement()
A low level method a create a structure element explicitly.protected void
storeNamespaceAttribute(String prefix, String uri)
protected void
storeProcessingInstruction(String target, String data)
protected void
storeQualifiedName(int item, String prefix, String uri, String localName)
-
Methods inherited from class com.sun.xml.stream.buffer.AbstractCreator
createBuffer, getXMLStreamBuffer, increaseTreeCount, peekAtContentObject, resizeContentCharacters, resizeContentObjects, resizeStructure, resizeStructureStrings, setBuffer, setHasInternedStrings, setXMLStreamBuffer, storeContentCharacters, storeContentCharactersCopy, storeContentObject, storeContentString, storeStructure, storeStructureString
-
-
-
-
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(XMLStreamReader reader) throws 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:
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
when xsb is to be created using a reader that is at<S:Envelope xmlns:n1=".."><S:Body><ns2:A> ...
<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 supportstoreElement(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)
-
storeAttribute
protected final void storeAttribute(String prefix, String uri, String localName, String type, String value)
-
getAttributeValuePrefixes
public final List getAttributeValuePrefixes()
-
storeProcessingInstruction
protected final void storeProcessingInstruction(String target, String data)
-
isCheckAttributeValue
public final boolean isCheckAttributeValue()
-
setCheckAttributeValue
public final void setCheckAttributeValue(boolean value)
-
-