XmlReader Class
- java.
lang. Object - com.
azure. xml. XmlReader
- com.
Implements
public abstract class XmlReader
implements AutoCloseable
Reads an XML encoded value as a stream of tokens.
Constructor Summary
Constructor | Description |
---|---|
XmlReader() |
Creates an instance of XmlReader. |
Method Summary
Modifier and Type | Method and Description |
---|---|
final T |
getNullableAttribute(String namespaceUri, String localName, ReadValueCallback<String,T> converter)
Gets the nullable value for the attribute in the XML element. |
final T |
getNullableElement(ReadValueCallback<String,T> converter)
Gets the nullable value for the current element. |
final T |
readObject(String localName, ReadValueCallback<XmlReader,T> converter)
Reads an object from the XML stream. |
final T |
readObject(String namespaceUri, String localName, ReadValueCallback<XmlReader,T> converter)
Reads an object from the XML stream. |
abstract void |
close()
Closes the XML stream. |
abstract
Xml |
currentToken()
Gets the XmlToken that the reader points to currently. |
final byte[] |
getBinaryAttribute(String namespaceUri, String localName)
Gets the binary value for the attribute in the XML element. |
final byte[] |
getBinaryElement()
Gets the binary value for the current element. |
final boolean |
getBooleanAttribute(String namespaceUri, String localName)
Gets the boolean value for the attribute in the XML element. |
final boolean |
getBooleanElement()
Gets the boolean value for the current element. |
final double |
getDoubleAttribute(String namespaceUri, String localName)
Gets the double value for the attribute in the XML element. |
final double |
getDoubleElement()
Gets the double value for the current element. |
abstract QName |
getElementName()
Gets the QName for the current XML element. |
final float |
getFloatAttribute(String namespaceUri, String localName)
Gets the float value for the attribute in the XML element. |
final float |
getFloatElement()
Gets the float value for the current element. |
final int |
getIntAttribute(String namespaceUri, String localName)
Gets the int value for the attribute in the XML element. |
final int |
getIntElement()
Gets the int value for the current element. |
final long |
getLongAttribute(String namespaceUri, String localName)
Gets the long value for the attribute in the XML element. |
final long |
getLongElement()
Gets the long value for the current element. |
abstract String |
getStringAttribute(String namespaceUri, String localName)
Gets the string value for the attribute in the XML element. |
abstract String |
getStringElement()
Gets the string value for the current element. |
abstract
Xml |
nextElement()
Iterates to and returns the next START_ELEMENT or END_ELEMENT in the XML stream. |
final void |
skipElement()
Skips the current XML element. |
Methods inherited from java.lang.Object
Constructor Details
XmlReader
public XmlReader()
Creates an instance of XmlReader.
Method Details
getNullableAttribute
public final T
Gets the nullable value for the attribute in the XML element.
If the attribute doesn't have a value or doesn't exist null will be returned, otherwise the attribute getStringAttribute(String namespaceUri, String localName) is passed to the converter.
Parameters:
Returns:
Throws:
getNullableElement
public final T
Gets the nullable value for the current element.
If the current element doesn't have a value null will be returned, otherwise the element getStringElement() is passed to the converter.
Parameters:
Returns:
Throws:
readObject
public final T
Reads an object from the XML stream.
Validates that the XmlReader is currently pointing to an START_ELEMENT which has the qualifying name specified by the startTagName
.
Parameters:
Returns:
Throws:
startTagName
readObject
public final T
Reads an object from the XML stream.
Validates that the XmlReader is currently pointing to an START_ELEMENT which has the qualifying name specified by the startTagName
.
Parameters:
Returns:
Throws:
startTagName
close
public abstract void close()
Closes the XML stream.
Throws:
currentToken
public abstract XmlToken currentToken()
Gets the XmlToken that the reader points to currently.
Returns START_DOCUMENT if the reader hasn't begun reading the XML stream. Returns END_DOCUMENT if the reader has completed reading the XML stream.
Returns:
getBinaryAttribute
public final byte[] getBinaryAttribute(String namespaceUri, String localName)
Gets the binary value for the attribute in the XML element.
Parameters:
Returns:
getBinaryElement
public final byte[] getBinaryElement()
Gets the binary value for the current element.
Returns:
Throws:
getBooleanAttribute
public final boolean getBooleanAttribute(String namespaceUri, String localName)
Gets the boolean value for the attribute in the XML element.
Parameters:
Returns:
getBooleanElement
public final boolean getBooleanElement()
Gets the boolean value for the current element.
Returns:
Throws:
getDoubleAttribute
public final double getDoubleAttribute(String namespaceUri, String localName)
Gets the double value for the attribute in the XML element.
Parameters:
Returns:
getDoubleElement
public final double getDoubleElement()
Gets the double value for the current element.
Returns:
Throws:
getElementName
public abstract QName getElementName()
Gets the QName for the current XML element.
Returns:
getFloatAttribute
public final float getFloatAttribute(String namespaceUri, String localName)
Gets the float value for the attribute in the XML element.
Parameters:
Returns:
getFloatElement
public final float getFloatElement()
Gets the float value for the current element.
Returns:
Throws:
getIntAttribute
public final int getIntAttribute(String namespaceUri, String localName)
Gets the int value for the attribute in the XML element.
Parameters:
Returns:
getIntElement
public final int getIntElement()
Gets the int value for the current element.
Returns:
Throws:
getLongAttribute
public final long getLongAttribute(String namespaceUri, String localName)
Gets the long value for the attribute in the XML element.
Parameters:
Returns:
getLongElement
public final long getLongElement()
Gets the long value for the current element.
Returns:
Throws:
getStringAttribute
public abstract String getStringAttribute(String namespaceUri, String localName)
Gets the string value for the attribute in the XML element.
Null is returned if the attribute doesn't exist in the XML element.
Parameters:
Returns:
getStringElement
public abstract String getStringElement()
Gets the string value for the current element.
Returns:
Throws:
nextElement
public abstract XmlToken nextElement()
Iterates to and returns the next START_ELEMENT or END_ELEMENT in the XML stream.
Returns END_DOCUMENT if iterating to the next element token completes reading of the XML stream.
Returns:
Throws:
skipElement
public final void skipElement()
Skips the current XML element.
If the currentToken() isn't an START_ELEMENT this is a no-op.
This reads the XML stream until the matching END_ELEMENT is found for the current START_ELEMENT.
Throws:
Applies to
Azure SDK for Java