## org.h2.build.doc
Class XMLParser

    java.lang.Object
      org.h2.build.doc.XMLParser

    public class XMLParser

extends java.lang.Object

This class implements a simple XML pull parser. Only a subset of the XML pull parser API is implemented.

Field Summary
`static int` `CHARACTERS` This event type means text has been read.
`static int` `COMMENT` This event type means a comment has been read.
`static int` `DTD` This event type means a DTD element has been read.
`static int` `END_DOCUMENT` This event type means the end of the document has been reached.
`static int` `END_ELEMENT` This event type means an end element has been read.
`static int` `ERROR` This event type means an error occurred.
`static int` `PROCESSING_INSTRUCTION` This event type means a processing instruction has been read.
`static int` `START_DOCUMENT` This event type is used before reading.
`static int` `START_ELEMENT` This event type means a start element has been read.

Constructor Summary
`XMLParser(java.lang.String xml)` Construct a new XML parser.

Method Summary
`int` `getAttributeCount()` Get the number of attributes.
`java.lang.String` `getAttributeLocalName(int index)` Get the local name of the attribute.
`java.lang.String` `getAttributeName(int index)` Get the full name of the attribute.
`java.lang.String` `getAttributePrefix(int index)` Get the prefix of the attribute.
`java.lang.String` `getAttributeValue(int index)` Get the value of this attribute.
`java.lang.String` `getAttributeValue(java.lang.String namespaceURI, java.lang.String name)` Get the value of this attribute.
`int` `getEventType()` Get the event type of the current token.
`java.lang.String` `getLocalName()` Get the local name of the current start or end element.
`java.lang.String` `getName()` Get the full name of the current start or end element.
`int` `getPos()` Get the current character position in the XML document.
`java.lang.String` `getPrefix()` Get the prefix of the current start or end element.
`java.lang.String` `getRemaining()` Get the remaining XML text of the document.
`java.lang.String` `getText()` Get the current text.
`java.lang.String` `getToken()` Get the current token text.
`boolean` `hasNext()` Check if there are more tags to read.
`boolean` `isWhiteSpace()` Check if the current character tag only contains spaces or other non-printable characters.
`int` `next()` Read the next tag.
`int` `nextTag()` Read the next start, end, or character tag.
`void` `setHTML(boolean html)` Enable or disable HTML processing.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### ERROR

    public static final int ERROR

  This event type means an error occurred.

  See Also:
    Constant Field Values

### START_ELEMENT

    public static final int START_ELEMENT

  This event type means a start element has been read.

  See Also:
    Constant Field Values

### END_ELEMENT

    public static final int END_ELEMENT

  This event type means an end element has been read.

  See Also:
    Constant Field Values

### PROCESSING_INSTRUCTION

    public static final int PROCESSING_INSTRUCTION

  This event type means a processing instruction has been read.

  See Also:
    Constant Field Values

### CHARACTERS

    public static final int CHARACTERS

  This event type means text has been read.

  See Also:
    Constant Field Values

### COMMENT

    public static final int COMMENT

  This event type means a comment has been read.

  See Also:
    Constant Field Values

### START_DOCUMENT

    public static final int START_DOCUMENT

  This event type is used before reading.

  See Also:
    Constant Field Values

### END_DOCUMENT

    public static final int END_DOCUMENT

  This event type means the end of the document has been reached.

  See Also:
    Constant Field Values

### DTD

    public static final int DTD

  This event type means a DTD element has been read.

  See Also:
    Constant Field Values

Constructor Detail

### XMLParser

    public XMLParser(java.lang.String xml)

  Construct a new XML parser.

  Parameters:
    `xml` - the document

Method Detail

### setHTML

    public void setHTML(boolean html)

  Enable or disable HTML processing. When enabled, attributes don't need to have values.

  Parameters:
    `html` - true if HTML processing is enabled.

### hasNext

    public boolean hasNext()

  Check if there are more tags to read.

  Returns:
    true if there are more tags

### next

    public int next()

  Read the next tag.

  Returns:
    the event type of the next tag

### nextTag

    public int nextTag()

  Read the next start, end, or character tag. This method skips comments, DTDs, and processing instructions.

  Returns:
    the event type of the next tag

### getEventType

    public int getEventType()

  Get the event type of the current token.

  Returns:
    the event type

### getText

    public java.lang.String getText()

  Get the current text.

  Returns:
    the text

### getToken

    public java.lang.String getToken()

  Get the current token text.

  Returns:
    the token

### getAttributeCount

    public int getAttributeCount()

  Get the number of attributes.

  Returns:
    the attribute count

### getAttributePrefix

    public java.lang.String getAttributePrefix(int index)

  Get the prefix of the attribute.

  Parameters:
    `index` - the index of the attribute (starting with 0)
  Returns:
    the prefix

### getAttributeLocalName

    public java.lang.String getAttributeLocalName(int index)

  Get the local name of the attribute.

  Parameters:
    `index` - the index of the attribute (starting with 0)
  Returns:
    the local name

### getAttributeName

    public java.lang.String getAttributeName(int index)

  Get the full name of the attribute. If there is no prefix, only the local name is returned, otherwise the prefix, ':', and the local name.

  Parameters:
    `index` - the index of the attribute (starting with 0)
  Returns:
    the full name

### getAttributeValue

    public java.lang.String getAttributeValue(int index)

  Get the value of this attribute.

  Parameters:
    `index` - the index of the attribute (starting with 0)
  Returns:
    the value

### getAttributeValue

    public java.lang.String getAttributeValue(java.lang.String namespaceURI,
                                              java.lang.String name)

  Get the value of this attribute.

  Parameters:
    `namespaceURI` - the namespace URI (currently ignored)
    `name` - the local name of the attribute
  Returns:
    the value or null

### getName

    public java.lang.String getName()

  Get the full name of the current start or end element. If there is no prefix, only the local name is returned, otherwise the prefix, ':', and the local name.

  Returns:
    the full name

### getLocalName

    public java.lang.String getLocalName()

  Get the local name of the current start or end element.

  Returns:
    the local name

### getPrefix

    public java.lang.String getPrefix()

  Get the prefix of the current start or end element.

  Returns:
    the prefix

### isWhiteSpace

    public boolean isWhiteSpace()

  Check if the current character tag only contains spaces or other non-printable characters.

  Returns:
    if the trimmed text is empty

### getRemaining

    public java.lang.String getRemaining()

  Get the remaining XML text of the document.

  Returns:
    the remaining XML

### getPos

    public int getPos()

  Get the current character position in the XML document.

  Returns:
    the position