org.apache.ws.commons.schema.walker
Class XmlSchemaWalker

java.lang.Object
  extended by org.apache.ws.commons.schema.walker.XmlSchemaWalker

public final class XmlSchemaWalker
extends Object

Walks an XmlSchema from a starting XmlSchemaElement, notifying attached visitors as it descends.


Constructor Summary
XmlSchemaWalker(XmlSchemaCollection xmlSchemas)
          Initializes the XmlSchemaWalker with the XmlScheamCollection to reference when following an XmlSchemaElement.
XmlSchemaWalker(XmlSchemaCollection xmlSchemas, XmlSchemaVisitor visitor)
          Initializes the XmlSchemaWalker with an XmlSchemaVisitor to notify as the schema is walked.
 
Method Summary
 XmlSchemaWalker addVisitor(XmlSchemaVisitor visitor)
          Adds a new visitor to be notified as the XML Schemas are walked.
 void clear()
          Clears the internal state in preparation for another walk through the schema.
 Set<QName> getUserRecognizedTypes()
          The user-defined types set with the call to setUserRecognizedTypes(Set), or null if none.
 XmlSchemaWalker removeVisitor(XmlSchemaVisitor visitor)
          Removes the visitor to be notified as the XML Schemas are walked.
 void setUserRecognizedTypes(Set<QName> userRecognizedTypes)
          Defines the set of types the calling code recognizes.
 void walk(XmlSchemaElement element)
          Initiates a walk through the XmlSchemaCollection starting with the provided root XmlSchemaElement.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XmlSchemaWalker

public XmlSchemaWalker(XmlSchemaCollection xmlSchemas)
Initializes the XmlSchemaWalker with the XmlScheamCollection to reference when following an XmlSchemaElement.


XmlSchemaWalker

public XmlSchemaWalker(XmlSchemaCollection xmlSchemas,
                       XmlSchemaVisitor visitor)
Initializes the XmlSchemaWalker with an XmlSchemaVisitor to notify as the schema is walked.

(Other visitors may continue to be added after this one.)

Parameters:
xmlSchemas - The set of schemas to walk.
visitor - The visitor to visit during the walk.
Method Detail

addVisitor

public XmlSchemaWalker addVisitor(XmlSchemaVisitor visitor)
Adds a new visitor to be notified as the XML Schemas are walked.

Parameters:
visitor - The visitor to be notified.
Returns:
This XmlSchemaWalker instance for method chaining.

removeVisitor

public XmlSchemaWalker removeVisitor(XmlSchemaVisitor visitor)
Removes the visitor to be notified as the XML Schemas are walked.

Parameters:
visitor - The visitor to remove.
Returns:
This XmlSchemaWalker instance for method chaining.

clear

public void clear()
Clears the internal state in preparation for another walk through the schema.


setUserRecognizedTypes

public void setUserRecognizedTypes(Set<QName> userRecognizedTypes)
Defines the set of types the calling code recognizes. If one of the types are found during the walk through the XML Schema, it is attached to the relevant XmlSchemaTypeInfo that is passed to the XmlSchemaVisitors, with lower types in the hierarchy taking precedence over higher types.

This information is useful when translating from XML Schema to another schema, as this automatically associates the destination type with the source XML Schema type.

Parameters:
userRecognizedTypes - The set of types the user recognizes and would like recognized when traversed.

getUserRecognizedTypes

public Set<QName> getUserRecognizedTypes()
The user-defined types set with the call to setUserRecognizedTypes(Set), or null if none.


walk

public void walk(XmlSchemaElement element)
Initiates a walk through the XmlSchemaCollection starting with the provided root XmlSchemaElement. Any visitors will be notified as the walk progresses.

Once this method completes, call clear() before starting another walk through the XML Schemas.

Parameters:
element - The root element to start the walk from.


Copyright © 2004-2015 The Apache Software Foundation. All Rights Reserved.