public final class XmlSchemaStateMachineGenerator extends Object implements XmlSchemaVisitor
XmlSchema
representing how to walk through the schema when parsing an XML document.Constructor and Description |
---|
XmlSchemaStateMachineGenerator()
Constructs a new
XmlSchemaStateMachineGenerator , ready to
start walking XmlSchema s. |
Modifier and Type | Method and Description |
---|---|
XmlSchemaStateMachineNode |
getStartNode()
Retrieves the start node of the state machine representing the
most-recently walked
XmlSchema . |
Map<QName,XmlSchemaStateMachineNode> |
getStateMachineNodesByQName()
Retrieves the
XmlSchemaStateMachineNode s representing each
XmlSchemaElement in the walked
XmlSchema . |
void |
onEndAttributes(org.apache.ws.commons.schema.XmlSchemaElement element,
XmlSchemaTypeInfo elemTypeInfo)
This method is called when all of the attributes have been processed
(provided the element has a type defined).
|
void |
onEnterAllGroup(org.apache.ws.commons.schema.XmlSchemaAll all)
Called when an all group is entered.
|
void |
onEnterChoiceGroup(org.apache.ws.commons.schema.XmlSchemaChoice choice)
Called when a choice group is entered.
|
void |
onEnterElement(org.apache.ws.commons.schema.XmlSchemaElement element,
XmlSchemaTypeInfo typeInfo,
boolean previouslyVisited)
A notification that an
XmlSchemaElement has been entered. |
void |
onEnterSequenceGroup(org.apache.ws.commons.schema.XmlSchemaSequence seq)
Called when a sequence is entered.
|
void |
onEnterSubstitutionGroup(org.apache.ws.commons.schema.XmlSchemaElement base)
This method is called when the walker enters a substitution group.
|
void |
onExitAllGroup(org.apache.ws.commons.schema.XmlSchemaAll all)
Called when an all group is exited.
|
void |
onExitChoiceGroup(org.apache.ws.commons.schema.XmlSchemaChoice choice)
Called when a choice group is exited.
|
void |
onExitElement(org.apache.ws.commons.schema.XmlSchemaElement element,
XmlSchemaTypeInfo typeInfo,
boolean previouslyVisited)
Signifies the end of the element that was previously entered.
|
void |
onExitSequenceGroup(org.apache.ws.commons.schema.XmlSchemaSequence seq)
Called when a sequence is exited.
|
void |
onExitSubstitutionGroup(org.apache.ws.commons.schema.XmlSchemaElement base)
Called when the end of the substitution group is reached.
|
void |
onVisitAny(org.apache.ws.commons.schema.XmlSchemaAny any)
Called when a wildcard element is entered.
|
void |
onVisitAnyAttribute(org.apache.ws.commons.schema.XmlSchemaElement element,
org.apache.ws.commons.schema.XmlSchemaAnyAttribute anyAttr)
Called when a wildcard attribute is visited.
|
void |
onVisitAttribute(org.apache.ws.commons.schema.XmlSchemaElement element,
XmlSchemaAttrInfo attrInfo)
This method is called for each attribute associated with the element,
providing the
XmlSchemaAttrInfo representing that attribute. |
public XmlSchemaStateMachineGenerator()
XmlSchemaStateMachineGenerator
, ready to
start walking XmlSchema
s.public XmlSchemaStateMachineNode getStartNode()
XmlSchema
.public Map<QName,XmlSchemaStateMachineNode> getStateMachineNodesByQName()
XmlSchemaStateMachineNode
s representing each
XmlSchemaElement
in the walked
XmlSchema
.
Only top-level XmlSchemaElement
s can be retrieved by calling
XmlSchema.getElementByName(QName)
;
this allows all elements to be retrieved without walking the schema
again.
public void onEnterElement(org.apache.ws.commons.schema.XmlSchemaElement element, XmlSchemaTypeInfo typeInfo, boolean previouslyVisited)
XmlSchemaVisitor
XmlSchemaElement
has been entered. The
element returned will be a true representation of the element at that
point in the schema: if the schema defines a reference, the reference is
followed and merged with its global definition.
The first time this element is reached, all of its attributes will be
visited (if any). Once the attributes have been visited,
XmlSchemaVisitor.onEndAttributes(XmlSchemaElement, XmlSchemaTypeInfo)
will be
called. The only exception is when the element has no type information,
at which point the next call will be to
XmlSchemaVisitor.onExitElement(XmlSchemaElement, XmlSchemaTypeInfo, boolean)
.
On all subsequent visits to this element, previouslyVisited
will be set to true
and the attributes will not be
revisited. The next call will be to
XmlSchemaVisitor.onExitElement(XmlSchemaElement, XmlSchemaTypeInfo, boolean)
, as
all of the element's attributes and children have already been provided.
onEnterElement
in interface XmlSchemaVisitor
element
- The element the walker is currently entering.typeInfo
- The type information of that element.previouslyVisited
- Whether the element was previously visited.XmlSchemaVisitor.onEnterElement(XmlSchemaElement, XmlSchemaTypeInfo,
boolean)
public void onExitElement(org.apache.ws.commons.schema.XmlSchemaElement element, XmlSchemaTypeInfo typeInfo, boolean previouslyVisited)
XmlSchemaVisitor
XmlSchemaVisitor.onEnterElement(XmlSchemaElement, XmlSchemaTypeInfo, boolean)
in
the event it is easier to process on exit.onExitElement
in interface XmlSchemaVisitor
element
- The element the walker is currently exiting.typeInfo
- The type information of that element.previouslyVisited
- Whether the element was previously visited.XmlSchemaVisitor.onExitElement(XmlSchemaElement, XmlSchemaTypeInfo,
boolean)
public void onVisitAttribute(org.apache.ws.commons.schema.XmlSchemaElement element, XmlSchemaAttrInfo attrInfo)
XmlSchemaVisitor
XmlSchemaAttrInfo
representing that attribute.onVisitAttribute
in interface XmlSchemaVisitor
element
- The element owing the attribute.attrInfo
- The attribute information.XmlSchemaVisitor.onVisitAttribute(XmlSchemaElement,
XmlSchemaAttrInfo)
public void onEndAttributes(org.apache.ws.commons.schema.XmlSchemaElement element, XmlSchemaTypeInfo elemTypeInfo)
XmlSchemaVisitor
onEndAttributes
in interface XmlSchemaVisitor
element
- The element the walker is traversing.elemTypeInfo
- Type information about the element, if it is easier to
process here.XmlSchemaVisitor.onEndAttributes(XmlSchemaElement,
XmlSchemaTypeInfo)
public void onEnterSubstitutionGroup(org.apache.ws.commons.schema.XmlSchemaElement base)
XmlSchemaVisitor
XmlSchemaVisitor.onEnterElement(XmlSchemaElement, XmlSchemaTypeInfo, boolean)
is
called for all types in the substitution group, starting with the base
type.
The only exception is when the base type of the substitution group is
abstract (XmlSchemaElement.isAbstract()
returns true
). When this happens,
XmlSchemaVisitor.onEnterElement(XmlSchemaElement, XmlSchemaTypeInfo, boolean)
is
not called with the abstract type, as there is no information to provide.
If the root element is the base of a substitution group, this method will
be the first one called. Otherwise,
XmlSchemaVisitor.onEnterElement(XmlSchemaElement, XmlSchemaTypeInfo, boolean)
will be called with the root element.
onEnterSubstitutionGroup
in interface XmlSchemaVisitor
base
- The XmlSchemaElement
representing the base of the
substitution group.XmlSchemaVisitor.onEnterSubstitutionGroup(XmlSchemaElement)
public void onExitSubstitutionGroup(org.apache.ws.commons.schema.XmlSchemaElement base)
XmlSchemaVisitor
onExitSubstitutionGroup
in interface XmlSchemaVisitor
base
- The base element of the subtitution group.XmlSchemaVisitor.onExitSubstitutionGroup(XmlSchemaElement)
public void onEnterAllGroup(org.apache.ws.commons.schema.XmlSchemaAll all)
XmlSchemaVisitor
onEnterAllGroup
in interface XmlSchemaVisitor
all
- The XmlSchemaAll
representing the all group.XmlSchemaVisitor.onEnterAllGroup(XmlSchemaAll)
public void onExitAllGroup(org.apache.ws.commons.schema.XmlSchemaAll all)
XmlSchemaVisitor
onExitAllGroup
in interface XmlSchemaVisitor
all
- The XmlSchemaAll
representing the all group.XmlSchemaVisitor.onExitAllGroup(XmlSchemaAll)
public void onEnterChoiceGroup(org.apache.ws.commons.schema.XmlSchemaChoice choice)
XmlSchemaVisitor
onEnterChoiceGroup
in interface XmlSchemaVisitor
XmlSchemaVisitor.onEnterChoiceGroup(XmlSchemaChoice)
public void onExitChoiceGroup(org.apache.ws.commons.schema.XmlSchemaChoice choice)
XmlSchemaVisitor
onExitChoiceGroup
in interface XmlSchemaVisitor
XmlSchemaVisitor.onExitChoiceGroup(XmlSchemaChoice)
public void onEnterSequenceGroup(org.apache.ws.commons.schema.XmlSchemaSequence seq)
XmlSchemaVisitor
onEnterSequenceGroup
in interface XmlSchemaVisitor
seq
- The XmlSchemaSequence
representing the sequence.XmlSchemaVisitor.onEnterSequenceGroup(XmlSchemaSequence)
public void onExitSequenceGroup(org.apache.ws.commons.schema.XmlSchemaSequence seq)
XmlSchemaVisitor
onExitSequenceGroup
in interface XmlSchemaVisitor
seq
- The XmlSchemaSequence
representing the sequence.XmlSchemaVisitor.onExitSequenceGroup(XmlSchemaSequence)
public void onVisitAny(org.apache.ws.commons.schema.XmlSchemaAny any)
XmlSchemaVisitor
onVisitAny
in interface XmlSchemaVisitor
any
- The XmlSchemaAny
representing the wildcard element.XmlSchemaVisitor.onVisitAny(XmlSchemaAny)
public void onVisitAnyAttribute(org.apache.ws.commons.schema.XmlSchemaElement element, org.apache.ws.commons.schema.XmlSchemaAnyAttribute anyAttr)
XmlSchemaVisitor
XmlSchemaVisitor.onEndAttributes(XmlSchemaElement, XmlSchemaTypeInfo)
.onVisitAnyAttribute
in interface XmlSchemaVisitor
element
- The owning element.anyAttr
- The XmlSchemaAnyAttribute
representing the
wildcard attribute.XmlSchemaVisitor.onVisitAnyAttribute(XmlSchemaElement,
XmlSchemaAnyAttribute)
Copyright © 2004–2017 The Apache Software Foundation. All rights reserved.