Class XmlSchemaStateMachineNode
java.lang.Object
org.apache.ws.commons.schema.docpath.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.
A SchemaStateMachineNode represents one of:
- An element, its type, and its attributes
- An all group
- A choice group
- A sequence group
- An <any> wildcard element
- A substitution group
Document is traversed, the state machine is used to
determine how to process the current element. Two passes will be needed: the
first pass will determine the correct path through the document's schema in
order to properly parse the elements, and the second traversal will read the
elements while following that path.-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final XmlSchemaAnyprivate final List<XmlSchemaAttrInfo> private final XmlSchemaElementprivate final longprivate final longprivate final XmlSchemaStateMachineNode.Typeprivate List<XmlSchemaStateMachineNode> private final XmlSchemaTypeInfo -
Constructor Summary
ConstructorsConstructorDescriptionXmlSchemaStateMachineNode(XmlSchemaStateMachineNode.Type nodeType, long minOccurs, long maxOccurs) Constructs a newSchemaStateMachineNodefor a group.Constructs aXmlSchemaStateMachineNodefrom theXmlSchemaAny.XmlSchemaStateMachineNode(XmlSchemaElement elem, List<XmlSchemaAttrInfo> attrs, XmlSchemaTypeInfo typeInfo) Constructs a newSchemaStateMachineNodefor an element. -
Method Summary
Modifier and TypeMethodDescription(package private) XmlSchemaStateMachineNodeAdds a state that could follow thisSchemaStateMachineNode.(package private) XmlSchemaStateMachineNodeaddPossibleNextStates(Collection<XmlSchemaStateMachineNode> nextStates) Adds the set of possible states that could follow thisSchemaStateMachineNode.getAny()Returns theXmlSchemaAnyassociated with this node, ornullif none.If thisSchemaStateMachineNoderepresents anXmlSchemaElement, the set ofXmlSchemaAttrInfos associated with the element it represents.If thisSchemaStateMachineNoderepresents anXmlSchemaElement, theXmlSchemaTypeInfoof the element it represents.longThe maximum number of times thisSchemaStateMachineNodemay appear in succession.longThe minimum number of times thisSchemaStateMachineNodemay appear in succession.The XML Schema nodeXmlSchemaStateMachineNode.TypethisSchemaStateMachineNoderepresents.All of the known possible states that could follow this one.toString()Builds aStringrepresenting thisXmlSchemaStateMachineNode.
-
Field Details
-
nodeType
-
element
-
attributes
-
typeInfo
-
minOccurs
private final long minOccurs -
maxOccurs
private final long maxOccurs -
any
-
possibleNextStates
-
-
Constructor Details
-
XmlSchemaStateMachineNode
XmlSchemaStateMachineNode(XmlSchemaStateMachineNode.Type nodeType, long minOccurs, long maxOccurs) Constructs a newSchemaStateMachineNodefor a group.- Parameters:
nodeType- The type of the group node (XmlSchemaStateMachineNode.Type.ALL,XmlSchemaStateMachineNode.Type.SUBSTITUTION_GROUP,XmlSchemaStateMachineNode.Type.CHOICE,XmlSchemaStateMachineNode.Type.SEQUENCE, orXmlSchemaStateMachineNode.Type.ANY).minOccurs- The minimum number of occurrences of this group.maxOccurs- The maximum number of occurrences of this group.- Throws:
IllegalArgumentException- if this constructor is used to define anXmlSchemaStateMachineNode.Type.ELEMENTor anXmlSchemaStateMachineNode.Type.ANY.
-
XmlSchemaStateMachineNode
XmlSchemaStateMachineNode(XmlSchemaElement elem, List<XmlSchemaAttrInfo> attrs, XmlSchemaTypeInfo typeInfo) Constructs a newSchemaStateMachineNodefor an element.- Parameters:
elem- TheXmlSchemaElementthis node represents.attrs- TheXmlSchemaAttributecontained by this element. An emptyListornullif none.typeInfo- The type information, if the element has simple content.nullif not.
-
XmlSchemaStateMachineNode
XmlSchemaStateMachineNode(XmlSchemaAny any) Constructs aXmlSchemaStateMachineNodefrom theXmlSchemaAny.- Parameters:
any- TheXmlSchemaAnyto construct the node from.
-
-
Method Details
-
getNodeType
The XML Schema nodeXmlSchemaStateMachineNode.TypethisSchemaStateMachineNoderepresents. -
getElement
-
getElementType
If thisSchemaStateMachineNoderepresents anXmlSchemaElement, theXmlSchemaTypeInfoof the element it represents. -
getAttributes
If thisSchemaStateMachineNoderepresents anXmlSchemaElement, the set ofXmlSchemaAttrInfos associated with the element it represents. -
getMinOccurs
public long getMinOccurs()The minimum number of times thisSchemaStateMachineNodemay appear in succession. -
getMaxOccurs
public long getMaxOccurs()The maximum number of times thisSchemaStateMachineNodemay appear in succession. -
getAny
Returns theXmlSchemaAnyassociated with this node, ornullif none. -
addPossibleNextState
Adds a state that could follow thisSchemaStateMachineNode.- Parameters:
next- A node that could follow this one in the XML document.- Returns:
- Itself, for chaining.
-
addPossibleNextStates
Adds the set of possible states that could follow thisSchemaStateMachineNode.- Parameters:
nextStates- The set of possible nodes that could follow this one in the XML document.- Returns:
- Itself, for chaining.
-
getPossibleNextStates
All of the known possible states that could follow this one. -
toString
Builds aStringrepresenting thisXmlSchemaStateMachineNode.
-