| java.lang.Object com.sun.xml.stream.XMLReaderImpl
XMLReaderImpl | public class XMLReaderImpl implements javax.xml.stream.XMLStreamReader(Code) | | This class implements javax.xml.stream.XMLStreamReader. It makes use of XML*Scanner classes to
derive most of its functionality. If desired, Application can reuse this instance by calling
reset() and setInputSource().
author: Neeraj Bajaj Sun Microsystems,Inc. author: K.Venugopal Sun Microsystems,Inc. |
Method Summary | |
public boolean | canReuse() This function tells if this instances is available for reuse. | public void | close() Frees any resources associated with this Reader. | XMLInputSource | convertSAXInputSource2XMLInputSource(InputSource inputSource) Convert SAX InputSource to XMLInputSource. | public javax.xml.namespace.QName | convertXNIQNametoJavaxQName(com.sun.xml.stream.xerces.xni.QName qname) | public int | getAttributeCount() Returns the count of attributes on this START_ELEMENT,
this method is only valid on a START_ELEMENT or ATTRIBUTE. | public String | getAttributeLocalName(int index) | public QName | getAttributeName(int index) | public String | getAttributeNamespace(int index) | public String | getAttributePrefix(int index) | public javax.xml.namespace.QName | getAttributeQName(int index) | public String | getAttributeType(int index) | public String | getAttributeValue(int index) | public String | getAttributeValue(String namespaceURI, String localName) | public String | getCharacterEncodingScheme() | public int | getColumnNumber() | public String | getElementText() Reads the content of a text-only element. | public String | getEncoding() Return input encoding if known or null if unknown. | protected List | getEntityDecls() | public int | getEventType() Returns the current value of the parse event as a string, this returns the string value of a CHARACTERS event, returns the value of a COMMENT, the replacement value for an ENTITY_REFERENCE, the string value of a CDATA section, the string value for a SPACE event, or the String value of the internal subset of the DTD. | final static String | getEventTypeString(int eventType) | public int | getLineNumber() | public String | getLocalName() | public Location | getLocation() Return the current location of the processor. | public javax.xml.namespace.QName | getName() | public NamespaceContext | getNamespaceContext() Returns a read only namespace context for the current
position. | public int | getNamespaceCount() Returns the count of namespaces declared on this START_ELEMENT or END_ELEMENT,
this method is only valid on a START_ELEMENT, END_ELEMENT or NAMESPACE. | public String | getNamespacePrefix(int index) Returns the prefix for the namespace declared at the
index. | public String | getNamespaceURI() | public String | getNamespaceURI(int index) Returns the uri for the namespace declared at the
index. | public String | getNamespaceURI(String prefix) Return the uri for the given prefix. | protected List | getNotationDecls() | public String | getPIData() | public String | getPITarget() | public String | getPrefix() Returns the prefix of the current event, or null if the event does
not have a prefix. | public Object | getProperty(java.lang.String name) | protected PropertyManager | getPropertyManager() | public String | getText() | public char[] | getTextCharacters() | public int | getTextCharacters(int sourceStart, char[] target, int targetStart, int length) Gets the the text associated with a CHARACTERS, SPACE or CDATA event.
Text starting a "sourceStart" is copied into "destination" starting at "targetStart".
Up to "length" characters are copied. | public int | getTextLength() | public int | getTextStart() | public String | getValue() | public String | getVersion() | public boolean | hasAttributes() | public boolean | hasName() | public boolean | hasNext() | public boolean | hasText() | public boolean | hasValue() | void | init(PropertyManager propertyManager) | public boolean | isAttributeSpecified(int index) | public boolean | isCharacters() | public boolean | isEndElement() | public boolean | isStandalone() | public boolean | isStartElement() | public boolean | isWhiteSpace() Returns true if the cursor points to a character data event that consists of all whitespace
Application calling this method needs to cache the value and avoid calling this method again
for the same event. | public int | next() | public int | nextTag() Skips any insignificant events (COMMENT and PROCESSING_INSTRUCTION)
until a START_ELEMENT or
END_ELEMENT is reached. | static void | pr(String str) | public void | require(int type, String namespaceURI, String localName) Test if the current event is of the given type and if the namespace and name match the current namespace and name of the current event. | public void | reset() Resets this instance so that this instance is ready for reuse. | public void | setInputSource(XMLInputSource inputSource) | public void | setInputSource(InputSource inputSource) Set the InputSource on this instance. | protected void | setPropertyManager(PropertyManager propertyManager) | public boolean | standaloneSet() |
DEBUG | final static boolean DEBUG(Code) | | debug flag
|
ENTITY_MANAGER | final protected static String ENTITY_MANAGER(Code) | | Property identifier: entity manager.
|
ERROR_REPORTER | final protected static String ERROR_REPORTER(Code) | | Property identifier: Error Reporter.
|
SYMBOL_TABLE | final protected static String SYMBOL_TABLE(Code) | | Property identifier: Symbol table.
|
fEntityScanner | protected XMLEntityReaderImpl fEntityScanner(Code) | | Entity scanner, this alwasy works on last entity that was opened.
|
canReuse | public boolean canReuse()(Code) | | This function tells if this instances is available for reuse.
One must call reset() and setInputSource() to be able to reuse
this instance.
|
close | public void close() throws XMLStreamException(Code) | | Frees any resources associated with this Reader. This method does not close the underlying input source.
throws: XMLStreamException - if there are errors freeing associated resources |
convertSAXInputSource2XMLInputSource | XMLInputSource convertSAXInputSource2XMLInputSource(InputSource inputSource)(Code) | | Convert SAX InputSource to XMLInputSource.
XMLInputSource XNI XMLInputSource. |
getAttributeCount | public int getAttributeCount()(Code) | | Returns the count of attributes on this START_ELEMENT,
this method is only valid on a START_ELEMENT or ATTRIBUTE. This
count excludes namespace definitions. Attribute indices are
zero-based.
returns the number of attributes throws: IllegalStateException - if this is not a START_ELEMENT or ATTRIBUTE |
getAttributeLocalName | public String getAttributeLocalName(int index)(Code) | | Parameters: index - |
getAttributeName | public QName getAttributeName(int index)(Code) | | Returns the localName of the attribute at the provided
index
Parameters: index - the position of the attribute the localName of the attribute throws: IllegalStateException - if this is not a START_ELEMENT or ATTRIBUTE |
getAttributeNamespace | public String getAttributeNamespace(int index)(Code) | | Returns the namespace of the attribute at the provided
index
Parameters: index - the position of the attribute the namespace URI (can be null) throws: IllegalStateException - if this is not a START_ELEMENT or ATTRIBUTE |
getAttributePrefix | public String getAttributePrefix(int index)(Code) | | Returns the prefix of this attribute at the
provided index
Parameters: index - the position of the attribute the prefix of the attribute throws: IllegalStateException - if this is not a START_ELEMENT or ATTRIBUTE |
getAttributeQName | public javax.xml.namespace.QName getAttributeQName(int index)(Code) | | Returns the qname of the attribute at the provided index
Parameters: index - the position of the attribute the QName of the attribute throws: IllegalStateException - if this is not a START_ELEMENT or ATTRIBUTE |
getAttributeType | public String getAttributeType(int index)(Code) | | Returns the XML type of the attribute at the provided
index
Parameters: index - the position of the attribute the XML type of the attribute throws: IllegalStateException - if this is not a START_ELEMENT or ATTRIBUTE |
getAttributeValue | public String getAttributeValue(int index)(Code) | | Returns the value of the attribute at the
index
Parameters: index - the position of the attribute the attribute value throws: IllegalStateException - if this is not a START_ELEMENT or ATTRIBUTE |
getAttributeValue | public String getAttributeValue(String namespaceURI, String localName)(Code) | | Parameters: namespaceURI - Parameters: localName - |
getCharacterEncodingScheme | public String getCharacterEncodingScheme()(Code) | | Returns the character encoding declared on the xml declaration Returns null if none was declared
the encoding declared in the document or null |
getColumnNumber | public int getColumnNumber()(Code) | | |
getElementText | public String getElementText() throws XMLStreamException(Code) | | Reads the content of a text-only element. Precondition:
the current event is START_ELEMENT. Postcondition:
The current event is the corresponding END_ELEMENT.
throws: XMLStreamException - if the current event is not a START_ELEMENT or ifa non text element is encountered |
getEncoding | public String getEncoding()(Code) | | Return input encoding if known or null if unknown.
the encoding of this instance or null |
getEntityDecls | protected List getEntityDecls()(Code) | | |
getEventType | public int getEventType()(Code) | | Returns the current value of the parse event as a string, this returns the string value of a CHARACTERS event, returns the value of a COMMENT, the replacement value for an ENTITY_REFERENCE, the string value of a CDATA section, the string value for a SPACE event, or the String value of the internal subset of the DTD. If an ENTITY_REFERENCE has been resolved, any character data will be reported as CHARACTERS events.
the current text or null |
getEventTypeString | final static String getEventTypeString(int eventType)(Code) | | |
getLineNumber | public int getLineNumber()(Code) | | |
getLocation | public Location getLocation()(Code) | | Return the current location of the processor.
If the Location is unknown the processor should return
an implementation of Location that returns -1 for the
location and null for the publicId and systemId.
The location information is only valid until next() is
called.
|
getName | public javax.xml.namespace.QName getName()(Code) | | Returns a QName for the current START_ELEMENT or END_ELEMENT event
the QName for the current START_ELEMENT or END_ELEMENT event |
getNamespaceContext | public NamespaceContext getNamespaceContext()(Code) | | Returns a read only namespace context for the current
position. The context is transient and only valid until
a call to next() changes the state of the reader.
return a namespace context |
getNamespaceCount | public int getNamespaceCount()(Code) | | Returns the count of namespaces declared on this START_ELEMENT or END_ELEMENT,
this method is only valid on a START_ELEMENT, END_ELEMENT or NAMESPACE. On
an END_ELEMENT the count is of the namespaces that are about to go
out of scope. This is the equivalent of the information reported
by SAX callback for an end element event.
returns the number of namespace declarations on this specific element throws: IllegalStateException - if this is not a START_ELEMENT, END_ELEMENT or NAMESPACE |
getNamespacePrefix | public String getNamespacePrefix(int index)(Code) | | Returns the prefix for the namespace declared at the
index. Returns null if this is the default namespace
declaration
Parameters: index - the position of the namespace declaration returns the namespace prefix throws: IllegalStateException - if this is not a START_ELEMENT, END_ELEMENT or NAMESPACE |
getNamespaceURI | public String getNamespaceURI(int index)(Code) | | Returns the uri for the namespace declared at the
index.
Parameters: index - the position of the namespace declaration returns the namespace uri throws: IllegalStateException - if this is not a START_ELEMENT, END_ELEMENT or NAMESPACE |
getNamespaceURI | public String getNamespaceURI(String prefix)(Code) | | Return the uri for the given prefix.
The uri returned depends on the current state of the processor.
NOTE:The 'xml' prefix is bound as defined in
Namespaces in XML
specification to "http://www.w3.org/XML/1998/namespace".
NOTE: The 'xmlns' prefix must be resolved to following namespace
http://www.w3.org/2000/xmlns/
the uri bound to the given prefix or null if it is not bound Parameters: prefix - The prefix to lookup, may not be null throws: IllegalStateException - if the prefix is null |
getNotationDecls | protected List getNotationDecls()(Code) | | |
getPIData | public String getPIData()(Code) | | Get the data section of a processing instruction
the data or null |
getPITarget | public String getPITarget()(Code) | | Get the target of a processing instruction
the target or null |
getPrefix | public String getPrefix()(Code) | | Returns the prefix of the current event, or null if the event does
not have a prefix. For START_ELEMENT and END_ELEMENT, return
XMLConstants.DEFAULT_NS_PREFIX when no prefix is available.
|
getPropertyManager | protected PropertyManager getPropertyManager()(Code) | | returns the reference to property manager. |
getText | public String getText()(Code) | | Returns the current value of the parse event as a string,
this returns the string value of a CHARACTERS event,
returns the value of a COMMENT, the replacement value
for an ENTITY_REFERENCE,
or the String value of the DTD
the current text or null throws: java.lang.IllegalStateException - if this state is nota valid text state. |
getTextCharacters | public char[] getTextCharacters()(Code) | | |
getTextCharacters | public int getTextCharacters(int sourceStart, char[] target, int targetStart, int length) throws XMLStreamException(Code) | | Gets the the text associated with a CHARACTERS, SPACE or CDATA event.
Text starting a "sourceStart" is copied into "destination" starting at "targetStart".
Up to "length" characters are copied. The number of characters actually copied is returned.
The "sourceStart" argument must be greater or equal to 0 and less than or equal to
the number of characters associated with the event. Usually, one requests text starting at a "sourceStart" of 0.
If the number of characters actually copied is less than the "length", then there is no more text.
Otherwise, subsequent calls need to be made until all text has been retrieved. For example:
int length = 1024;
char[] myBuffer = new char[ length ];
for ( int sourceStart = 0 ; ; sourceStart += length )
{
int nCopied = stream.getTextCharacters( sourceStart, myBuffer, 0, length );
if (nCopied < length)
break;
}
XMLStreamException may be thrown if there are any XML errors in the underlying source.
The "targetStart" argument must be greater than or equal to 0 and less than the length of "target",
Length must be greater than 0 and "targetStart + length" must be less than or equal to length of "target".
Parameters: sourceStart - the index of the first character in the source array to copy Parameters: target - the destination array Parameters: targetStart - the start offset in the target array Parameters: length - the number of characters to copy the number of characters actually copied throws: XMLStreamException - if the underlying XML source is not well-formed throws: IndexOutOfBoundsException - if targetStart < 0 or > than the length of target throws: IndexOutOfBoundwhile - (isCharacters()) ;sException if length < 0 or targetStart + length > length of target throws: UnsupportedOperationException - if this method is not supported throws: NullPointerException - is if target is null |
getTextLength | public int getTextLength()(Code) | | |
getTextStart | public int getTextStart()(Code) | | |
getVersion | public String getVersion()(Code) | | Get the XML language version of the current document being parsed
|
hasAttributes | public boolean hasAttributes()(Code) | | |
hasName | public boolean hasName()(Code) | | this Funtion returns true if the current event has name
|
hasText | public boolean hasText()(Code) | | Return true if the current event has text, false otherwise
The following events have text:
CHARACTERS,DTD ,ENTITY_REFERENCE, COMMENT
|
hasValue | public boolean hasValue()(Code) | | |
isAttributeSpecified | public boolean isAttributeSpecified(int index)(Code) | | Returns a boolean which indicates if this
attribute was created by default
Parameters: index - the position of the attribute true if this is a default attribute throws: IllegalStateException - if this is not a START_ELEMENT or ATTRIBUTE |
isCharacters | public boolean isCharacters()(Code) | | Returns true if the cursor points to a character data event
true if the cursor points to character data, false otherwise |
isEndElement | public boolean isEndElement()(Code) | | |
isStandalone | public boolean isStandalone()(Code) | | |
isStartElement | public boolean isStartElement()(Code) | | |
isWhiteSpace | public boolean isWhiteSpace()(Code) | | Returns true if the cursor points to a character data event that consists of all whitespace
Application calling this method needs to cache the value and avoid calling this method again
for the same event.
|
nextTag | public int nextTag() throws XMLStreamException(Code) | | Skips any insignificant events (COMMENT and PROCESSING_INSTRUCTION)
until a START_ELEMENT or
END_ELEMENT is reached. If other than space characters are
encountered, an exception is thrown. This method should
be used when processing element-only content because
the parser is not able to recognize ignorable whitespace if
then DTD is missing or not interpreted.
the event type of the element read throws: XMLStreamException - if the current event is not white space |
require | public void require(int type, String namespaceURI, String localName) throws XMLStreamException(Code) | | Test if the current event is of the given type and if the namespace and name match the current namespace and name of the current event.
If the namespaceURI is null it is not checked for equality, if the localName is null it is not checked for equality.
Parameters: type - the event type Parameters: namespaceURI - the uri of the event, may be null Parameters: localName - the localName of the event, may be null throws: XMLStreamException - if the required values are not matched. |
reset | public void reset()(Code) | | Resets this instance so that this instance is ready for reuse.
|
standaloneSet | public boolean standaloneSet()(Code) | | Checks if standalone was set in the document
true if standalone was set in the document, or false otherwise |
|
|