See: Description
Class | Description |
---|---|
DomBuilderFromSax |
Builds an XML
Document from an XML Schema during a SAX
walk. |
SaxWalkerOverDom |
Walks over a
Document in a SAX style, notifying listeners with SAX
events. |
XmlSchemaDocumentNode<U> |
The
XmlSchemaDocumentNode represents a node in the XML Schema as
it is used by an XML document. |
XmlSchemaNamespaceContext | |
XmlSchemaPathFinder<U,V> |
Performs a SAX-based walk through the XML document, determining the
interpretation ("path") that best matches the XML Schema.
|
XmlSchemaPathNode<U,V> |
This represents a node in the path when walking an XML or Avro document.
|
XmlSchemaStateMachineGenerator |
Builds a state machine from an
XmlSchema
representing how to walk through the schema when parsing an XML document. |
XmlSchemaStateMachineNode |
This represents a node in the state machine used when parsing an XML
Document based on its
XmlSchema and Avro
org.apache.avro.Schema . |
Enum | Description |
---|---|
XmlSchemaPathNode.Direction |
Represents a path's direction.
|
XmlSchemaStateMachineNode.Type |
XmlSchemaCollection
to determine
how the document conforms to its schema.
This is done in four steps:
XmlSchemaCollection
,
represented as
XmlSchemaStateMachineNode
s.
SAXParser
, when working with raw XML, or
SaxWalkerOverDom
when
working with an Document
.
XmlSchemaPathFinder
to build a series of
XmlSchemaDocumentNode
s
and XmlSchemaPathNode
s
representing a valid walk through the
XmlSchemaCollection
.
XmlSchemaDocumentNode.setUserDefinedContent(Object)
and
XmlSchemaPathNode.setUserDefinedContent(Object)
.
XmlSchemaStateMachineNode
represents a single node in the
XmlSchema
- either an element or a
group - and the possible nodes that may follow (children of the element
or group). Only one state machine node will be created by the
XmlSchemaStateMachineGenerator
for each XmlSchemaElement
, meaning
the XmlSchemaStateMachineNode
s
may loop back on themselves if an XML element is a child of itself.
As XmlSchemaStateMachineNode
s
represent the XML Schema,
XmlSchemaDocumentNode
s
represent the XML Schema as applied to an XML Document. Each node
represents all occurrences of the node in the XML Document, and a different
set of children can be requested, one for each occurrence. Document nodes
never loop back on themselves; if an element is a child of itself, a new
document node instance will be created at each level in the tree.
As a result, the
XmlSchemaDocumentNode
s form a
tree structure, starting with the root node of the document and working
downward. User-defined content can be attached to each node in the tree
using the
XmlSchemaPathNode.setUserDefinedContent(Object)
.
method.
Where XmlSchemaDocumentNode
s
represent the XML Schema structure used to describe the XML Document,
XmlSchemaPathNode
s define the
actual walk through the XML Schema taken to represent that document.
Paths may go in four
XmlSchemaPathNode.Direction
s:
XmlSchemaPathNode.Direction.CHILD
:
The path moves from the current node in the tree (an element or group)
to one of its children.
XmlSchemaPathNode.Direction.PARENT
:
The path moves from the current node in the tree to its parent. If
moving to the parent of an element, this closes the tag.
XmlSchemaPathNode.Direction.SIBLING
:
This initiates a new occurrence of the current (wildcard) element or
group. If creating a sibling (wildcard) element, this closes the tag of
the existing element and opens a new one of the same name.
XmlSchemaPathNode.Direction.CONTENT
:
This represents content inside an element (not children tags). This
will either be the simple content of a simple element, or the text
contained inside a mixed element. Mixed content may occur as either
a direct child of the owning element, or inside one of the owning
element's child groups.
XmlSchemaPathFinder
builds
XmlSchemaDocumentNode
s
and XmlSchemaPathNode
s
from XmlSchemaStateMachineNode
during a SAX walk of an XML document. In addition to confirming the XML
Document conforms to its schema's structure, it will also confirm attribute
and element content conform to its expected type.
Note: This is done entirely over a SAX walk, meaning the source need not be an XML Document at all. Any data structure that can be traversed via a SAX walk can be confirmed to conform against an expected XML Schema.
This allows SAX-based walks over Document
objects.
One can use this in conjunction with
XmlSchemaPathFinder
to
confirm a document parsed using a DocumentBuilder
conforms to its XML Schema.
In the reverse direction, one can use
DomBuilderFromSax
to build an
Document
based on an XML Schema and a SAX walk over
content that represents a document conforming to that
XmlSchema
. For best results, use
XmlSchemaStateMachineGenerator
to build a mapping of QName
s to
XmlSchemaStateMachineNode
s.
This is used by the DomBuilderFromSax
to resolve ambiguities
in how to generate the XML Document based on the schema.
Copyright © 2004–2017 The Apache Software Foundation. All rights reserved.