com.mapinfo.midev.xml.read

## Interface IXmlReader

All Superinterfaces:
  AutoCloseable, Closeable

    public interface IXmlReader
    extends Closeable

An interface for reading XML.

### Method Summary

All Methods Instance Methods Abstract Methods
`void` `close()` Close the reader and the underlying stream.
`String` `getAttribute(String localName)` Get the value of the attribute from the current element with the specified local name and no namespace.
`String` `getAttribute(String localName, String namespaceURI)` Get the value of the attribute from the current element with the specified local name and namespace URI.
`int` `getAttributeCount()` Get the number of attributes in the current element.
`Iterator` `getAttributeIterator()` Get an iterator for the attributes in the current element.
`int` `getDepth()` Get the depth of the current element.
`String` `getEncoding()` Get the encoding of the underlying XML.
`String` `getLocalName()` Get the local name of the current element.
`String` `getNamespaceURI()` Get the namespace URI of the current element.
`String` `getPrefix()` Get the namespace prefix of the current element.
`String` `getXmlLang()` Get the language of the current element.
`XmlSpace` `getXmlSpace()` Get the space of the current element.
`boolean` `isEOF()` Determine whether or not the reader is currently at the end of the stream.
`boolean` `isStartElement()` Determine whether or not the reader is currently positioned at the start tag of an element.
`boolean` `isStartElement(String localName)` Determine whether or not the reader is currently positioned at the start tag of an element.
`boolean` `isStartElement(String localName, String ns)` Determine whether or not the reader is currently positioned at the start tag of an element.
`String` `lookupNamespace(String prefix)` Get the current namespace URI for the specified prefix.
`Optional` `readBoolean(String localName)` Get the value of the attribute from the current element with the specified local name and namespace URI.
`Optional` `readBoolean(String localName, String namespaceURI)` Get the value of the attribute from the current element with the specified local name and namespace URI.
`Optional` `readDouble(String localName)` Get the value of the attribute from the current element with the specified local name.
`Optional` `readDouble(String localName, String namespaceURI)` Get the value of the attribute from the current element with the specified local name and namespace URI.
`String` `readElementString()` Get the content of the current element.
`String` `readElementString(String localName)` Get the content of the current element and verify that it has the specified local name.
`String` `readElementString(String localName, String ns)` Get the content of the current element and verify that it has the specified local name and namespace URI.
`void` `readEndElement()` Move the reader past the current element's end tag.
`Optional` `readFloat(String localName)` Get the value of the attribute from the current element with the specified local name.
`Optional` `readFloat(String localName, String namespaceURI)` Get the value of the attribute from the current element with the specified local name and namespace URI.
`String` `readInnerXml()` Get all of the elements and attributes within the current element.
`Optional` `readInt(String localName)` Get the value of the attribute from the current element with the specified local name.
`Optional` `readInt(String localName, String namespaceURI)` Get the value of the attribute from the current element with the specified local name and namespace URI.
`String` `readOuterXml()` Get the current element, its attributes, and all of the elements and attributes within the current element.
`Optional` `readShort(String localName)` Get the value of the attribute from the current element with the specified local name.
`Optional` `readShort(String localName, String namespaceURI)` Get the value of the attribute from the current element with the specified local name and namespace URI.
`void` `readStartElement()` Move past the start tag of the current element.
`void` `readStartElement(String localName)` Move past the start tag of the current element and verify that the element has the specified local name.
`void` `readStartElement(String localName, String ns)` Move past the start tag of the current element and verify that the element has the specified local name and namespace URI.
`Optional` `readString(String localName)` Get the value of the attribute from the current element with the specified local name.
`Optional` `readString(String localName, String namespaceURI)` Get the value of the attribute from the current element with the specified local name and namespace URI.
`void` `skip()` Skip the current element including all of its children.

### Method Detail

#### getLocalName

    String getLocalName()

Get the local name of the current element.

Returns:
  The local name of the current element. May not be null.

#### getNamespaceURI

    String getNamespaceURI()

Get the namespace URI of the current element.

Returns:
  The namespace URI of the current element. May not be null but may be an empty string if the current element is not in a namespace.

#### getPrefix

    String getPrefix()

Get the namespace prefix of the current element.

Returns:
  The namespace prefix of the current element. May be null if the namespace of the current element has no prefix declared.

#### getDepth

    int getDepth()

Get the depth of the current element.

Returns:
  The depth of the current element. The root element has a depth of '0'. Children of the root element have a depth of '1' and so on. Once the reader has moved past the end tag of the root element '0' is returned.

#### getXmlSpace

    XmlSpace getXmlSpace()

Get the space of the current element. Note that the space is inherited from the element's ancestors. The space is defined by a "space" attribute in the "http://www.w3.org/XML/1998/namespace" or "http://www.w3.org/2001/XMLSchema" namespace.

Returns:
  The space of the current element.

#### getXmlLang

    String getXmlLang()

Get the language of the current element. Note that the language is inherited from the element's ancestors. The space is defined by a "lang" attribute in the "http://www.w3.org/XML/1998/namespace" or "http://www.w3.org/2001/XMLSchema" namespace.

Returns:
  The language of the current element.

#### getAttributeCount

    int getAttributeCount()

Get the number of attributes in the current element.

Returns:
  The number of attributes in the current element.

#### getAttribute

    String getAttribute(String localName)

Get the value of the attribute from the current element with the specified local name and no namespace.

Parameters:
  `localName` - The local name of the attribute to get from the current element.
Returns:
  The value of attribute from the current element or null if the attribute with the specified local name and no namespace does not exist in the current element.

#### getAttribute

    String getAttribute(String localName,
                        String namespaceURI)

Get the value of the attribute from the current element with the specified local name and namespace URI.

Parameters:
  `localName` - The local name of the attribute to get from the current element.
  `namespaceURI` - The namespace URI of the attribute to get from the current element.
Returns:
  The value of attribute from the current element or null if the attribute with the specified local name and namespace URI does not exist in the current element.

#### readShort

    Optional readShort(String localName)

Get the value of the attribute from the current element with the specified local name.

Parameters:
  `localName` - The local name of the attribute to get from the current element.
Returns:
  The value of attribute from the current element or empty if the attribute with the specified local name does not exist in the current element.

#### readShort

    Optional readShort(String localName,
                       String namespaceURI)

Get the value of the attribute from the current element with the specified local name and namespace URI.

Parameters:
  `localName` - The local name of the attribute to get from the current element.
  `namespaceURI` - The namespace URI of the attribute to get from the current element.
Returns:
  The value of attribute from the current element or empty if the attribute with the specified local name and namespace URI does not exist in the current element.

#### readInt

    Optional readInt(String localName)

Get the value of the attribute from the current element with the specified local name.

Parameters:
  `localName` - The local name of the attribute to get from the current element.
Returns:
  The value of attribute from the current element or empty if the attribute with the specified local name does not exist in the current element.

#### readInt

    Optional readInt(String localName,
                     String namespaceURI)

Get the value of the attribute from the current element with the specified local name and namespace URI.

Parameters:
  `localName` - The local name of the attribute to get from the current element.
  `namespaceURI` - The namespace URI of the attribute to get from the current element.
Returns:
  The value of attribute from the current element or empty if the attribute with the specified local name and namespace URI does not exist in the current element.

#### readFloat

    Optional readFloat(String localName)

Get the value of the attribute from the current element with the specified local name.

Parameters:
  `localName` - The local name of the attribute to get from the current element.
Returns:
  The value of attribute from the current element or empty if the attribute with the specified local name does not exist in the current element.

#### readFloat

    Optional readFloat(String localName,
                       String namespaceURI)

Get the value of the attribute from the current element with the specified local name and namespace URI.

Parameters:
  `localName` - The local name of the attribute to get from the current element.
  `namespaceURI` - The namespace URI of the attribute to get from the current element.
Returns:
  The value of attribute from the current element or empty if the attribute with the specified local name and namespace URI does not exist in the current element.

#### readDouble

    Optional readDouble(String localName)

Get the value of the attribute from the current element with the specified local name.

Parameters:
  `localName` - The local name of the attribute to get from the current element.
Returns:
  The value of attribute from the current element or empty if the attribute with the specified local name does not exist in the current element.

#### readDouble

    Optional readDouble(String localName,
                        String namespaceURI)

Get the value of the attribute from the current element with the specified local name and namespace URI.

Parameters:
  `localName` - The local name of the attribute to get from the current element.
  `namespaceURI` - The namespace URI of the attribute to get from the current element.
Returns:
  The value of attribute from the current element or empty if the attribute with the specified local name and namespace URI does not exist in the current element.

#### readBoolean

    Optional readBoolean(String localName)

Get the value of the attribute from the current element with the specified local name and namespace URI.

Parameters:
  `localName` - The local name of the attribute to get from the current element.
Returns:
  The value of attribute from the current element or empty if the attribute with the specified local name and namespace URI does not exist in the current element.

#### readBoolean

    Optional readBoolean(String localName,
                         String namespaceURI)

Get the value of the attribute from the current element with the specified local name and namespace URI.

Parameters:
  `localName` - The local name of the attribute to get from the current element.
  `namespaceURI` - The namespace URI of the attribute to get from the current element.
Returns:
  The value of attribute from the current element or empty if the attribute with the specified local name and namespace URI does not exist in the current element.

#### readString

    Optional readString(String localName)

Get the value of the attribute from the current element with the specified local name.

Parameters:
  `localName` - The local name of the attribute to get from the current element.
Returns:
  The value of attribute from the current element or empty if the attribute with the specified local name does not exist in the current element.

#### readString

    Optional readString(String localName,
                        String namespaceURI)

Get the value of the attribute from the current element with the specified local name and namespace URI.

Parameters:
  `localName` - The local name of the attribute to get from the current element.
  `namespaceURI` - The namespace URI of the attribute to get from the current element.
Returns:
  The value of attribute from the current element or empty if the attribute with the specified local name and namespace URI does not exist in the current element.

#### getAttributeIterator

    Iterator getAttributeIterator()

Get an iterator for the attributes in the current element.

Returns:
  An iterator for the attributes in the current element. May not be null.

#### isEOF

    boolean isEOF()

Determine whether or not the reader is currently at the end of the stream.

Returns:
  true if the reader is currently at the end of the stream; false otherwise.

#### close

    void close()
        throws XmlReaderException

Close the reader and the underlying stream.

Specified by:
  `close` in interface `AutoCloseable`
Specified by:
  `close` in interface `Closeable`
Throws:
  `XmlReaderException` - If an error has occured in the process of closing the reader.

#### getEncoding

    String getEncoding()

Get the encoding of the underlying XML.

Returns:
  The encoding of the underlying XML.

#### skip

    void skip()
       throws XmlReaderException

Skip the current element including all of its children. Following a call to this method, the reader is placed at the next sibling of the current element. If no such sibling exists, the reader is placed at the end tag of the current element's parent.

Throws:
  `XmlReaderException`

#### readStartElement

    void readStartElement()
                   throws XmlReaderException

Move past the start tag of the current element. Note that once this method has been called, the element's attributes may not be available.

Throws:
  `XmlReaderException`

#### readStartElement

    void readStartElement(String localName)
                   throws XmlReaderException

Move past the start tag of the current element and verify that the element has the specified local name. Note that once this method has been called, the element's attributes may not be available.

Parameters:
  `localName` - Verify that this is the local name of the current element.
Throws:
  `XmlReaderException` - if the specified local name of the current element is incorrect.

#### readStartElement

    void readStartElement(String localName,
                          String ns)
                   throws XmlReaderException

Move past the start tag of the current element and verify that the element has the specified local name and namespace URI. Note that once this method has been called, the element's attributes may not be available.

Parameters:
  `localName` - Verify that this is the local name of the current element.
  `ns` - Verify that this is the namespace URI of the current element.
Throws:
  `XmlReaderException` - if the specified local name and namespace URI of the current element are incorrect.

#### readElementString

    String readElementString()
                      throws XmlReaderException

Get the content of the current element.

Returns:
  The content of the current element.
Throws:
  `XmlReaderException` - if the current element does not contain text (only elements).

#### readElementString

    String readElementString(String localName)
                      throws XmlReaderException

Get the content of the current element and verify that it has the specified local name.

Parameters:
  `localName` - Verify that this is the local name of the current element.
Returns:
  The content of the current element.
Throws:
  `XmlReaderException` - if the current element does not contain text (only elements) or if the specified local name of the current element are incorrect.

#### readElementString

    String readElementString(String localName,
                             String ns)
                      throws XmlReaderException

Get the content of the current element and verify that it has the specified local name and namespace URI.

Parameters:
  `localName` - Verify that this is the local name of the current element.
  `ns` - Verify that this is the namespace URI of the current element.
Returns:
  The content of the current element.
Throws:
  `XmlReaderException` - if the current element does not contain text (only elements) or if the specified local name and namespace URI of the current element are incorrect.

#### readEndElement

    void readEndElement()
                 throws XmlReaderException

Move the reader past the current element's end tag.

Throws:
  `XmlReaderException` - if the reader is not currently at an element end tag.

#### isStartElement

    boolean isStartElement()

Determine whether or not the reader is currently positioned at the start tag of an element.

Returns:
  true if the reader is currently positioned at the start tag of an element; false otherwise.

#### isStartElement

    boolean isStartElement(String localName)
                    throws XmlReaderException

Determine whether or not the reader is currently positioned at the start tag of an element.

Parameters:
  `localName` - Verify that this is the local name of the current element.
Returns:
  true if the reader is currently positioned at the start tag of an element; false otherwise.
Throws:
  `XmlReaderException`

#### isStartElement

    boolean isStartElement(String localName,
                           String ns)
                    throws XmlReaderException

Determine whether or not the reader is currently positioned at the start tag of an element.

Parameters:
  `localName` - Verify that this is the local name of the current element.
  `ns` - Verify that this is the namespace URI of the current element.
Returns:
  true if the reader is currently positioned at the start tag of an element; false otherwise.
Throws:
  `XmlReaderException`

#### readInnerXml

    String readInnerXml()
                 throws XmlReaderException

Get all of the elements and attributes within the current element. Once called, the reader's position is directly after the current element.

Returns:
  All of the elements and attributes within the current element.
Throws:
  `XmlReaderException`

#### readOuterXml

    String readOuterXml()
                 throws XmlReaderException

Get the current element, its attributes, and all of the elements and attributes within the current element. Once called, the reader's position is directly after the current element.

Returns:
  The current element, its attributes, and all of the elements and attributes within the current element.
Throws:
  `XmlReaderException`

#### lookupNamespace

    String lookupNamespace(String prefix)

Get the current namespace URI for the specified prefix.

Parameters:
  `prefix` - Get the current namespace URI for this prefix.
Returns:
  The current namespace URI for the specified prefix. May be null of there is no namespace with the specified prefix or the specified prefix was empty or null.