org.enhydra.apache.xerces.validators.schema
Class TraverseSchema
java.lang.Object
|
+--org.enhydra.apache.xerces.validators.schema.TraverseSchema
- All Implemented Interfaces:
- NamespacesScope.NamespacesHandler
- public class TraverseSchema
- extends Object
- implements NamespacesScope.NamespacesHandler
Instances of this class get delegated to Traverse the Schema and
to populate the Grammar internal representation by
instances of Grammar objects.
Traverse a Schema Grammar:
- Version:
- $Id: TraverseSchema.java,v 1.2 2005/01/26 08:28:44 jkjome Exp $
- Author:
- Eric Ye, IBM, Jeffrey Rodriguez, IBM, Andy Clark, IBM
- See Also:
Grammar
Inner Class Summary |
class |
TraverseSchema.ComplexTypeInfo
|
(package private) static class |
TraverseSchema.ErrorHandler
|
(package private) static class |
TraverseSchema.IgnoreWhitespaceParser
|
(package private) static class |
TraverseSchema.Resolver
Don't check the following code in because it creates a dependency on
the serializer, preventing to package the parser without the serializer
//Unit Test here
public static void main(String args[] ) {
if( args.length != 1 ) {
System.out.println( "Error: Usage java TraverseSchema yourFile.xsd" );
System.exit(0);
}
DOMParser parser = new IgnoreWhitespaceParser();
parser.setEntityResolver( (fEntityResolver != null)? (fEntityResolver):(new Resolver()) );
parser.setErrorHandler( new ErrorHandler() );
try {
parser.setFeature("http://xml.org/sax/features/validation", false);
parser.setFeature("http://apache.org/xml/features/dom/defer-node-expansion", false);
}catch( org.xml.sax.SAXNotRecognizedException e ) {
e.printStackTrace();
}catch( org.xml.sax.SAXNotSupportedException e ) {
e.printStackTrace();
}
try {
parser.parse( args[0]);
}catch( IOException e ) {
e.printStackTrace();
}catch( SAXException e ) {
e.printStackTrace();
}
Document document = parser.getDocument(); //Our Grammar
OutputFormat format = new OutputFormat( document );
java.io.StringWriter outWriter = new java.io.StringWriter();
XMLSerializer serial = new XMLSerializer( outWriter,format);
TraverseSchema tst = null;
try {
Element root = document.getDocumentElement();// This is what we pass to TraverserSchema
//serial.serialize( root );
//System.out.println(outWriter.toString());
tst = new TraverseSchema( root, new StringPool(), new SchemaGrammar(), (GrammarResolver) new GrammarResolverImpl() );
}
catch (Exception e) {
e.printStackTrace(System.err);
}
parser.getDocument();
} |
class |
TraverseSchema.SchemaInfo
|
Constructor Summary |
TraverseSchema(Element root,
StringPool stringPool,
SchemaGrammar schemaGrammar,
GrammarResolver grammarResolver,
boolean fullChecking,
GeneralAttrCheck generalAttrCheck)
|
TraverseSchema(Element root,
StringPool stringPool,
SchemaGrammar schemaGrammar,
GrammarResolver grammarResolver,
XMLErrorReporter errorReporter,
String schemaURL,
boolean fullChecking,
GeneralAttrCheck generalAttrCheck)
|
TraverseSchema(Element root,
StringPool stringPool,
SchemaGrammar schemaGrammar,
GrammarResolver grammarResolver,
XMLErrorReporter errorReporter,
String schemaURL,
EntityResolver entityResolver,
boolean fullChecking,
GeneralAttrCheck generalAttrCheck,
String externalSchemaLocations,
String noNamespaceSchemaLocation)
|
Method Summary |
void |
doTraverseSchema(Element root,
StringPool stringPool,
SchemaGrammar schemaGrammar,
GrammarResolver grammarResolver)
|
(package private) boolean |
elementInSet(int ele,
int[] set)
|
void |
endNamespaceDeclScope(int prefix)
endNamespaceDeclScope is called when a namespace scope ends |
DatatypeValidator |
getDatatypeValidator(String uri,
String localpart)
|
(package private) TraverseSchema.ComplexTypeInfo |
getElementDeclTypeInfoFromNS(String newSchemaURI,
String localpart)
|
(package private) DatatypeValidator |
getElementDeclTypeValidatorFromNS(String newSchemaURI,
String localpart)
|
(package private) String |
getLocalPart(String fullName)
|
(package private) int |
getLocalPartIndex(String fullName)
|
(package private) String |
getPrefix(String fullName)
|
(package private) int |
getPrefixIndex(String fullName)
|
(package private) TraverseSchema.ComplexTypeInfo |
getTypeInfoFromNS(String newSchemaURI,
String localpart)
|
(package private) DatatypeValidator |
getTypeValidatorFromNS(String newSchemaURI,
String localpart)
|
(package private) int[] |
intersect2sets(int[] one,
int[] theOther)
|
int |
maxEffectiveTotalRange(int contentSpecIndex)
|
int |
minEffectiveTotalRange(int contentSpecIndex)
|
boolean |
particleEmptiable(int contentSpecIndex)
|
void |
setFullConstraintCheckingEnabled()
|
void |
setGrammarResolver(GrammarResolver grammarResolver)
|
void |
startNamespaceDeclScope(int prefix,
int uri)
startNamespaceDeclScope is called when a new namespace scope is created |
(package private) boolean |
subset2sets(int[] subSet,
int[] superSet)
|
(package private) int |
traverseAll(Element allDecl)
Traverse the "All" declaration
Content: (annotation? , element*)
|
(package private) int |
traverseChoice(Element choiceDecl)
Traverse the Choice declaration
Content: (annotation? , (element | group | choice | sequence | any)*)
|
(package private) int |
traverseSequence(Element sequenceDecl)
Traverse the Sequence declaration
Content: (annotation? , (element | group | choice | sequence | any)*)
|
(package private) int[] |
union2sets(int[] one,
int[] theOther)
|
Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SchemaForSchemaURI
public static final String SchemaForSchemaURI
TraverseSchema
public TraverseSchema(Element root,
StringPool stringPool,
SchemaGrammar schemaGrammar,
GrammarResolver grammarResolver,
XMLErrorReporter errorReporter,
String schemaURL,
EntityResolver entityResolver,
boolean fullChecking,
GeneralAttrCheck generalAttrCheck,
String externalSchemaLocations,
String noNamespaceSchemaLocation)
throws Exception
TraverseSchema
public TraverseSchema(Element root,
StringPool stringPool,
SchemaGrammar schemaGrammar,
GrammarResolver grammarResolver,
XMLErrorReporter errorReporter,
String schemaURL,
boolean fullChecking,
GeneralAttrCheck generalAttrCheck)
throws Exception
TraverseSchema
public TraverseSchema(Element root,
StringPool stringPool,
SchemaGrammar schemaGrammar,
GrammarResolver grammarResolver,
boolean fullChecking,
GeneralAttrCheck generalAttrCheck)
throws Exception
setFullConstraintCheckingEnabled
public void setFullConstraintCheckingEnabled()
setGrammarResolver
public void setGrammarResolver(GrammarResolver grammarResolver)
startNamespaceDeclScope
public void startNamespaceDeclScope(int prefix,
int uri)
- Description copied from interface:
NamespacesScope.NamespacesHandler
- startNamespaceDeclScope is called when a new namespace scope is created
- Specified by:
startNamespaceDeclScope
in interface NamespacesScope.NamespacesHandler
- Following copied from interface:
org.enhydra.apache.xerces.utils.NamespacesScope.NamespacesHandler
- Parameters:
prefix
- the StringPool handle of the namespace prefix being declareduri
- the StringPool handle of the namespace's URI- Throws:
Exception
-
endNamespaceDeclScope
public void endNamespaceDeclScope(int prefix)
- Description copied from interface:
NamespacesScope.NamespacesHandler
- endNamespaceDeclScope is called when a namespace scope ends
- Specified by:
endNamespaceDeclScope
in interface NamespacesScope.NamespacesHandler
- Following copied from interface:
org.enhydra.apache.xerces.utils.NamespacesScope.NamespacesHandler
- Parameters:
prefix
- the StringPool handle of the namespace prefix going out of scope- Throws:
Exception
-
particleEmptiable
public boolean particleEmptiable(int contentSpecIndex)
minEffectiveTotalRange
public int minEffectiveTotalRange(int contentSpecIndex)
maxEffectiveTotalRange
public int maxEffectiveTotalRange(int contentSpecIndex)
doTraverseSchema
public void doTraverseSchema(Element root,
StringPool stringPool,
SchemaGrammar schemaGrammar,
GrammarResolver grammarResolver)
throws Exception
getDatatypeValidator
public DatatypeValidator getDatatypeValidator(String uri,
String localpart)
intersect2sets
int[] intersect2sets(int[] one,
int[] theOther)
union2sets
int[] union2sets(int[] one,
int[] theOther)
subset2sets
boolean subset2sets(int[] subSet,
int[] superSet)
elementInSet
boolean elementInSet(int ele,
int[] set)
getLocalPartIndex
int getLocalPartIndex(String fullName)
getLocalPart
String getLocalPart(String fullName)
getPrefixIndex
int getPrefixIndex(String fullName)
getPrefix
String getPrefix(String fullName)
getTypeValidatorFromNS
DatatypeValidator getTypeValidatorFromNS(String newSchemaURI,
String localpart)
throws Exception
getTypeInfoFromNS
TraverseSchema.ComplexTypeInfo getTypeInfoFromNS(String newSchemaURI,
String localpart)
throws Exception
getElementDeclTypeValidatorFromNS
DatatypeValidator getElementDeclTypeValidatorFromNS(String newSchemaURI,
String localpart)
throws Exception
getElementDeclTypeInfoFromNS
TraverseSchema.ComplexTypeInfo getElementDeclTypeInfoFromNS(String newSchemaURI,
String localpart)
throws Exception
traverseSequence
int traverseSequence(Element sequenceDecl)
throws Exception
- Traverse the Sequence declaration
Content: (annotation? , (element | group | choice | sequence | any)*)
traverseChoice
int traverseChoice(Element choiceDecl)
throws Exception
- Traverse the Choice declaration
Content: (annotation? , (element | group | choice | sequence | any)*)
traverseAll
int traverseAll(Element allDecl)
throws Exception
- Traverse the "All" declaration
Content: (annotation? , element*)
Copyright © 1999 The Apache Software Foundation. All Rights reserved.