Class StAXReader
- java.lang.Object
-
- com.sun.xml.rpc.streaming.XMLReaderBase
-
- com.sun.xml.rpc.streaming.StAXReader
-
- All Implemented Interfaces:
XMLReader
public class StAXReader extends XMLReaderBase
An implementation of XMLReader that uses StAX
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classStAXReader.AttributesImpl
-
Constructor Summary
Constructors Constructor Description StAXReader(StringReader stringReader, boolean rejectDTDs)StAXReader(Source source, boolean rejectDTDs)StAXReader(InputSource source, boolean rejectDTDs)StAXReader(InputSource source, boolean rejectDTDs, XMLStreamReader reader)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Close the XMLReader.AttributesgetAttributes()Return the current attribute list.intgetElementId()Return the current element ID.intgetLineNumber()Return the current line number.StringgetLocalName()Return the current local name.QNamegetName()Return the current qualified name.IteratorgetPrefixes()Return an iterator on all prefixes in scope, except for the default prefix.intgetState()Return the current state of the XMLReader.StringgetURI()Return the current URI.StringgetURI(String prefix)Return the URI for the given prefix.StringgetValue()Return the current value.XMLStreamReadergetXMLStreamReader()Returns the StAX XMLStreamReader that is being used.intnext()Return the next state of the XMLReader.XMLReaderrecordElement()Records the current element and leaves the reader positioned on its end tag.voidskipElement(int id)Skip all nodes up to the end tag of the element with the given element ID.voidsynchronizeReader()Used to resync the StAXReader with its underlying XMLStreamReader.-
Methods inherited from class com.sun.xml.rpc.streaming.XMLReaderBase
nextContent, nextElementContent, skipElement
-
-
-
-
Constructor Detail
-
StAXReader
public StAXReader(InputSource source, boolean rejectDTDs)
-
StAXReader
public StAXReader(InputSource source, boolean rejectDTDs, XMLStreamReader reader)
-
StAXReader
public StAXReader(Source source, boolean rejectDTDs)
-
StAXReader
public StAXReader(StringReader stringReader, boolean rejectDTDs)
-
-
Method Detail
-
getXMLStreamReader
public XMLStreamReader getXMLStreamReader()
Returns the StAX XMLStreamReader that is being used. If this is called, the code must call StAXReader.synchronize() after the stream reader has been used so that the StAXReader has correct information.- Returns:
- The actual XMLStreamReader being used. The StAXReader object will not contain valid information once the underlying reader is used separately.
- See Also:
synchronizeReader()
-
synchronizeReader
public void synchronizeReader()
Used to resync the StAXReader with its underlying XMLStreamReader. The element id stack may not be valid.- See Also:
getXMLStreamReader()
-
next
public int next()
Description copied from interface:XMLReaderReturn the next state of the XMLReader. The return value is one of: START, END, CHARS, PI, EOF.
-
getState
public int getState()
Description copied from interface:XMLReaderReturn the current state of the XMLReader.
-
getName
public QName getName()
Description copied from interface:XMLReaderReturn the current qualified name.Meaningful only when the state is one of: START, END.
-
getLocalName
public String getLocalName()
Description copied from interface:XMLReaderReturn the current local name.Meaningful only when the state is one of: START, END, PI.
-
getURI
public String getURI()
Description copied from interface:XMLReaderReturn the current URI.Meaningful only when the state is one of: START, END.
-
getAttributes
public Attributes getAttributes()
Description copied from interface:XMLReaderReturn the current attribute list.Meaningful only when the state is one of: START.
The returned
Attributesobject belong to the XMLReader and is only guaranteed to be valid until theXMLReader.next()method is called, directly or indirectly.
-
getURI
public String getURI(String prefix)
Description copied from interface:XMLReaderReturn the URI for the given prefix.If there is no namespace declaration in scope for the given prefix, return null.
-
getValue
public String getValue()
Description copied from interface:XMLReaderReturn the current value.Meaningful only when the state is one of: CHARS, PI.
-
getLineNumber
public int getLineNumber()
Description copied from interface:XMLReaderReturn the current line number.Due to aggressive parsing, this value may be off by a few lines.
-
getPrefixes
public Iterator getPrefixes()
Description copied from interface:XMLReaderReturn an iterator on all prefixes in scope, except for the default prefix.
-
getElementId
public int getElementId()
Description copied from interface:XMLReaderReturn the current element ID.
-
skipElement
public void skipElement(int id)
Description copied from interface:XMLReaderSkip all nodes up to the end tag of the element with the given element ID.- Specified by:
skipElementin interfaceXMLReader- Specified by:
skipElementin classXMLReaderBase
-
recordElement
public XMLReader recordElement()
Description copied from interface:XMLReaderRecords the current element and leaves the reader positioned on its end tag.The XMLReader must be positioned on the start tag of the element. The returned reader will play back all events starting with the start tag of the element and ending with its end tag.
-
close
public void close()
Description copied from interface:XMLReaderClose the XMLReader.All subsequent calls to
XMLReader.next()will return EOF.
-
-