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.ATTRIBUTE, CDATA, CHARACTERS, COMMENT, DTD, END_DOCUMENT, END_ELEMENT, ENTITY_DECLARATION, ENTITY_REFERENCE, NAMESPACE, NOTATION_DECLARATION, PROCESSING_INSTRUCTION, SPACE, START_DOCUMENT, START_ELEMENT
Constructor and Description |
---|
XMLStreamReaderValidator(javax.xml.stream.XMLStreamReader delegate,
boolean throwExceptions) |
Modifier and Type | Method and Description |
---|---|
String |
getElementText() |
protected void |
logParserState()
Dump the current event of the delegate.
|
int |
next() |
int |
nextTag() |
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
public XMLStreamReaderValidator(javax.xml.stream.XMLStreamReader delegate, boolean throwExceptions)
delegate
- XMLStreamReader to validatethrowExceptions
- (true if exceptions should be thrown when errors are encountered)public int next() throws javax.xml.stream.XMLStreamException
next
in interface javax.xml.stream.XMLStreamReader
next
in class XMLStreamReaderWrapper
javax.xml.stream.XMLStreamException
public String getElementText() throws javax.xml.stream.XMLStreamException
getElementText
in interface javax.xml.stream.XMLStreamReader
getElementText
in class XMLStreamReaderWrapper
javax.xml.stream.XMLStreamException
public int nextTag() throws javax.xml.stream.XMLStreamException
nextTag
in interface javax.xml.stream.XMLStreamReader
nextTag
in class XMLStreamReaderWrapper
javax.xml.stream.XMLStreamException
protected void logParserState()
Copyright © The Apache Software Foundation. All Rights Reserved.