Package com.bea.xml.stream
Class SubReader
java.lang.Object
com.bea.xml.stream.ReaderDelegate
com.bea.xml.stream.SubReader
- All Implemented Interfaces:
XMLStreamConstants
,XMLStreamReader
Creates a SubReader over a node of a document
-
Field Summary
Fields inherited from interface javax.xml.stream.XMLStreamConstants
ATTRIBUTE, CDATA, CHARACTERS, COMMENT, DTD, END_DOCUMENT, END_ELEMENT, ENTITY_DECLARATION, ENTITY_REFERENCE, NAMESPACE, NOTATION_DECLARATION, PROCESSING_INSTRUCTION, SPACE, START_DOCUMENT, START_ELEMENT
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
hasNext()
Returns true if there are more parsing events and false if there are no more events.static void
boolean
boolean
moveToEndElement
(String localName) boolean
moveToEndElement
(String localName, String namespaceUri) boolean
boolean
moveToStartElement
(String localName) boolean
moveToStartElement
(String localName, String namespaceUri) int
next()
Get next parsing event - a processor may return all contiguous character data in a single chunk, or it may split it into several chunks.int
static void
print
(XMLStreamReader r, int depth) static void
sub
(XMLStreamReader r, int depth) Methods inherited from class com.bea.xml.stream.ReaderDelegate
close, getAttributeCount, getAttributeLocalName, getAttributeName, getAttributeNamespace, getAttributePrefix, getAttributeType, getAttributeValue, getAttributeValue, getCharacterEncodingScheme, getDelegate, getElementText, getEncoding, getEventType, getLocalName, getLocation, getName, getNamespaceContext, getNamespaceCount, getNamespacePrefix, getNamespaceURI, getNamespaceURI, getNamespaceURI, getPIData, getPITarget, getPrefix, getProperty, getText, getTextCharacters, getTextCharacters, getTextLength, getTextStart, getVersion, hasName, hasText, isAttributeSpecified, isCharacters, isEndElement, isStandalone, isStartElement, isWhiteSpace, nextTag, require, setDelegate, standaloneSet
-
Constructor Details
-
SubReader
- Throws:
XMLStreamException
-
-
Method Details
-
next
Description copied from interface:javax.xml.stream.XMLStreamReader
Get next parsing event - a processor may return all contiguous character data in a single chunk, or it may split it into several chunks. If the property javax.xml.stream.isCoalescing is set to true element content must be coalesced and only one CHARACTERS event must be returned for contiguous element content or CDATA Sections. By default entity references must be expanded and reported transparently to the application. An exception will be thrown if an entity reference cannot be expanded. If element content is empty (i.e. content is "") then no CHARACTERS event will be reported.Given the following XML:
<foo><!--description-->content text<![CDATA[<greeting>Hello</greeting>]]>other content</foo>
The behavior of calling next() when being on foo will be:
1- the comment (COMMENT)
2- then the characters section (CHARACTERS)
3- then the CDATA section (another CHARACTERS)
4- then the next characters section (another CHARACTERS)
5- then the END_ELEMENT
NOTE: empty element (such as <tag/>) will be reported with two separate events: START_ELEMENT, END_ELEMENT - This preserves parsing equivalency of empty element to <tag></tag>. This method will throw an IllegalStateException if it is called after hasNext() returns false.
- Specified by:
next
in interfaceXMLStreamReader
- Overrides:
next
in classReaderDelegate
- Returns:
- the integer code corresponding to the current parse event
- Throws:
XMLStreamException
- See Also:
-
nextElement
- Throws:
XMLStreamException
-
hasNext
Description copied from interface:javax.xml.stream.XMLStreamReader
Returns true if there are more parsing events and false if there are no more events. This method will return false if the current state of the XMLStreamReader is END_DOCUMENT- Specified by:
hasNext
in interfaceXMLStreamReader
- Overrides:
hasNext
in classReaderDelegate
- Returns:
- true if there are more events, false otherwise
- Throws:
XMLStreamException
- if there is a fatal error detecting the next state
-
moveToStartElement
- Throws:
XMLStreamException
-
moveToStartElement
- Throws:
XMLStreamException
-
moveToStartElement
- Throws:
XMLStreamException
-
moveToEndElement
- Throws:
XMLStreamException
-
moveToEndElement
- Throws:
XMLStreamException
-
moveToEndElement
- Throws:
XMLStreamException
-
print
- Throws:
XMLStreamException
-
sub
- Throws:
Exception
-
main
- Throws:
Exception
-