public final class XmlSchemaPathFinder<U,V> extends DefaultHandler
This is a traditional DefaultHandler
that can be attached to either a
SAXParser
during a parse, or to
SaxWalkerOverDom
to find paths through an
Document
.
Because this is a SAX-based walk, the source information need not be an XML document. It can be any data that can be interpreted via a SAX walk. This can be helpful when trying to confirm the source data can be converted back into XML.
Constructor and Description |
---|
XmlSchemaPathFinder(XmlSchemaStateMachineNode root)
Creates a new
XmlToAvroPathCreator with the root
XmlSchemaStateMachineNode to start from when evaluating
documents. |
Modifier and Type | Method and Description |
---|---|
void |
characters(char[] ch,
int start,
int length)
Adds a new
XmlSchemaPathNode.Direction.CONTENT
XmlSchemaPathNode to the path. |
void |
endDocument()
Called when the XML Document traversal is complete.
|
void |
endElement(String uri,
String localName,
String qName)
Ends the current element.
|
void |
endPrefixMapping(String prefix)
Handles the end of a prefix mapping in the SAX walk.
|
XmlSchemaPathNode<U,V> |
getXmlSchemaTraversal()
Once a traversal completes successfully, this method may be called to
retrieve the relevant interpretation of the path through the
XmlSchemaStateMachineNode s. |
void |
startDocument()
Kick-starts a new SAX walk, building new
XmlSchemaPathNode
and XmlSchemaDocumentNode traversals in the process. |
void |
startElement(String uri,
String localName,
String qName,
Attributes atts)
Find the path through the XML Schema that best matches this element,
traversing any relevant groups, and backtracking if necessary.
|
void |
startPrefixMapping(String prefix,
String uri)
Handles a new prefix mapping in the SAX walk.
|
error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, unparsedEntityDecl, warning
public XmlSchemaPathFinder(XmlSchemaStateMachineNode root)
XmlToAvroPathCreator
with the root
XmlSchemaStateMachineNode
to start from when evaluating
documents.public void startDocument() throws SAXException
XmlSchemaPathNode
and XmlSchemaDocumentNode
traversals in the process.startDocument
in interface ContentHandler
startDocument
in class DefaultHandler
SAXException
DefaultHandler.startDocument()
public void startPrefixMapping(String prefix, String uri) throws SAXException
startPrefixMapping
in interface ContentHandler
startPrefixMapping
in class DefaultHandler
SAXException
DefaultHandler.startPrefixMapping(String, String)
public void endPrefixMapping(String prefix) throws SAXException
endPrefixMapping
in interface ContentHandler
endPrefixMapping
in class DefaultHandler
SAXException
DefaultHandler.endPrefixMapping(String)
public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException
startElement
in interface ContentHandler
startElement
in class DefaultHandler
SAXException
DefaultHandler.startElement(String, String, String, Attributes)
public void characters(char[] ch, int start, int length) throws SAXException
XmlSchemaPathNode.Direction.CONTENT
XmlSchemaPathNode
to the path. Throws an
IllegalStateException
if the owning element should not receive
content, or the content is empty when it should not be.characters
in interface ContentHandler
characters
in class DefaultHandler
SAXException
DefaultHandler.characters(char[], int, int)
public void endElement(String uri, String localName, String qName) throws SAXException
uri
and localName
, throws an
IllegalStateException
.endElement
in interface ContentHandler
endElement
in class DefaultHandler
SAXException
DefaultHandler.endElement(String, String, String)
public void endDocument() throws SAXException
Confirms all open elements have been closed. If not, throws an
IllegalStateException
.
endDocument
in interface ContentHandler
endDocument
in class DefaultHandler
SAXException
public XmlSchemaPathNode<U,V> getXmlSchemaTraversal()
XmlSchemaStateMachineNode
s.
XmlSchemaPathNode.getDocumentNode()
can be called to retrieve the
interpretation of the XML Schema as applied to the document; meanwhile
the walk through XmlSchemaPathNode
s will show how that schema was
traversed.
Copyright © 2004–2017 The Apache Software Foundation. All rights reserved.