Package org.apache.axiom.util.stax.debug

# Class XMLStreamReaderValidator

java.lang.Object
org.apache.axiom.util.stax.wrapper.XMLStreamReaderWrapper
org.apache.axiom.util.stax.debug.XMLStreamReaderValidator

All Implemented Interfaces:
  `XMLStreamConstants`, `XMLStreamReader`

public class XMLStreamReaderValidator extends XMLStreamReaderWrapper
`XMLStreamReader` wrapper that performs some simple consistency checks on the events returned by the wrapper reader. This is most useful for custom `XMLStreamReader` implementations. Validating events can help find and correct errors when they occur. Otherwise the errors may be caught much further downstream and hard to fix. In its current version, the validator ensures that the start element events match the end element events.

- ## Field Summary

  ### Fields inherited from interface javax.xml.stream.XMLStreamConstants

  `ATTRIBUTE, CDATA, CHARACTERS, COMMENT, DTD, END_DOCUMENT, END_ELEMENT, ENTITY_DECLARATION, ENTITY_REFERENCE, NAMESPACE, NOTATION_DECLARATION, PROCESSING_INSTRUCTION, SPACE, START_DOCUMENT, START_ELEMENT`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `XMLStreamReaderValidator(XMLStreamReader delegate, boolean throwExceptions)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `getElementText()`
  `protected void`
  `logParserState()`
  Dump the current event of the delegate.
  `int`
  `next()`
  `int`
  `nextTag()`

  ### Methods inherited from class org.apache.axiom.util.stax.wrapper.XMLStreamReaderWrapper

  `close, getAttributeCount, getAttributeLocalName, getAttributeName, getAttributeNamespace, getAttributePrefix, getAttributeType, getAttributeValue, getAttributeValue, getCharacterEncodingScheme, getEncoding, getEventType, getLocalName, getLocation, getName, getNamespaceContext, getNamespaceCount, getNamespacePrefix, getNamespaceURI, getNamespaceURI, getNamespaceURI, getParent, getPIData, getPITarget, getPrefix, getProperty, getText, getTextCharacters, getTextCharacters, getTextLength, getTextStart, getVersion, hasName, hasNext, hasText, isAttributeSpecified, isCharacters, isEndElement, isStandalone, isStartElement, isWhiteSpace, require, standaloneSet`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### XMLStreamReaderValidator

    public XMLStreamReaderValidator(XMLStreamReader delegate, boolean throwExceptions)
    Parameters:
      `delegate` - XMLStreamReader to validate
      `throwExceptions` - (true if exceptions should be thrown when errors are encountered)

- ## Method Details

  - ### next

    public int next() throws XMLStreamException
    Specified by:
      `next` in interface `XMLStreamReader`
    Overrides:
      `next` in class `XMLStreamReaderWrapper`
    Throws:
      `XMLStreamException`

  - ### getElementText

    public String getElementText() throws XMLStreamException
    Specified by:
      `getElementText` in interface `XMLStreamReader`
    Overrides:
      `getElementText` in class `XMLStreamReaderWrapper`
    Throws:
      `XMLStreamException`

  - ### nextTag

    public int nextTag() throws XMLStreamException
    Specified by:
      `nextTag` in interface `XMLStreamReader`
    Overrides:
      `nextTag` in class `XMLStreamReaderWrapper`
    Throws:
      `XMLStreamException`

  - ### logParserState

    protected void logParserState()
    Dump the current event of the delegate.