org.apache.xerces.impl.xs.traversers
Class XSDHandler

java.lang.Object
  extended by org.apache.xerces.impl.xs.traversers.XSDHandler

public class XSDHandler
extends Object

The purpose of this class is to co-ordinate the construction of a grammar object corresponding to a schema. To do this, it must be prepared to parse several schema documents (for instance if the schema document originally referred to contains or information items). If any of the schemas imports a schema, other grammars may be constructed as a side-effect.

Version:
$Id: XSDHandler.java 949234 2010-05-28 17:30:35Z mrglavas $
Author:
Neil Graham, IBM, Pavani Mukthipudi, Sun Microsystems

Field Summary
protected static String ALLOW_JAVA_ENCODINGS
          Feature identifier: allow java encodings
protected static String CONTINUE_AFTER_FATAL_ERROR
          Feature identifier: continue after fatal error
protected static boolean DEBUG_NODE_POOL
           
protected static String DISALLOW_DOCTYPE
          Feature: disallow doctype
protected static String ENTITY_MANAGER
          Property identifier: entity manager.
static String ENTITY_RESOLVER
          Property identifier: entity resolver.
protected static String ERROR_HANDLER
          Property identifier: error handler.
static String ERROR_REPORTER
          Property identifier: error reporter.
protected  XSDeclarationPool fDeclPool
           
protected  Hashtable fNotationRegistry
           
protected static String GENERATE_SYNTHETIC_ANNOTATIONS
          Feature: generate synthetic annotations
protected static String HONOUR_ALL_SCHEMALOCATIONS
          Feature identifier: honour all schemaLocations
protected static String JAXP_SCHEMA_SOURCE
          Property identifier: JAXP schema source.
protected static String LOCALE
          Property identifier: locale.
protected static String NAMESPACE_GROWTH
          Feature identifier: namespace growth
static String REDEF_IDENTIFIER
           
protected static String SECURITY_MANAGER
          Property identifier: security manager.
protected static String STANDARD_URI_CONFORMANT_FEATURE
          Feature identifier: allow java encodings
protected static String STRING_INTERNING
          Feature identifier: string interning.
static String SYMBOL_TABLE
          Property identifier: symbol table.
protected static String TOLERATE_DUPLICATES
          Feature identifier: tolerate duplicates
protected static String VALIDATE_ANNOTATIONS
          Feature identifier: validate annotations.
protected static String VALIDATION
          Feature identifier: validation.
static String XMLGRAMMAR_POOL
          Property identifier: grammar pool.
protected static String XMLSCHEMA_VALIDATION
          feature identifier: XML Schema validation
 
Constructor Summary
XSDHandler()
           
XSDHandler(XSGrammarBucket gBucket)
           
 
Method Summary
protected  void buildGlobalNameRegistries()
           
protected  org.apache.xerces.impl.xs.traversers.XSDocumentInfo constructTrees(Element schemaRoot, String locationHint, XSDDescription desc, boolean nsCollision)
           
 SimpleLocator element2Locator(Element e)
          Extract location information from an Element node, and create a new SimpleLocator object from such information.
 boolean element2Locator(Element e, SimpleLocator l)
          Extract location information from an Element node, store such information in the passed-in SimpleLocator object, then return true.
protected  SchemaGrammar findGrammar(XSDDescription desc, boolean ignoreConflict)
          First try to find a grammar in the bucket, if failed, consult the grammar pool.
protected  Object getGlobalDecl(String declKey, int declType)
           
protected  Object getGlobalDecl(org.apache.xerces.impl.xs.traversers.XSDocumentInfo currSchema, int declType, QName declToTraverse, Element elmNode)
           
protected  Object getGlobalDeclFromGrammar(SchemaGrammar sGrammar, int declType, String localpart)
           
protected  Object getGlobalDeclFromGrammar(SchemaGrammar sGrammar, int declType, String localpart, String schemaLoc)
           
protected  Hashtable getIDRegistry_sub()
           
protected  Hashtable getIDRegistry()
           
 SchemaGrammar parseSchema(XMLInputSource is, XSDDescription desc, Hashtable locationPairs)
          This method initiates the parse of a schema.
 void reset(XMLComponentManager componentManager)
           
protected  void resolveKeyRefs()
           
 String schemaDocument2SystemId(org.apache.xerces.impl.xs.traversers.XSDocumentInfo schemaDoc)
           
 void setDeclPool(XSDeclarationPool declPool)
           
 void setDVFactory(SchemaDVFactory dvFactory)
           
 void setGenerateSyntheticAnnotations(boolean state)
           
protected  void storeKeyRef(Element keyrefToStore, org.apache.xerces.impl.xs.traversers.XSDocumentInfo schemaDoc, XSElementDecl currElemDecl)
           
protected  Object traverseGlobalDecl(int declType, Element decl, org.apache.xerces.impl.xs.traversers.XSDocumentInfo schemaDoc, SchemaGrammar grammar)
           
protected  void traverseSchemas(ArrayList annotationInfo)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VALIDATION

protected static final String VALIDATION
Feature identifier: validation.

See Also:
Constant Field Values

XMLSCHEMA_VALIDATION

protected static final String XMLSCHEMA_VALIDATION
feature identifier: XML Schema validation

See Also:
Constant Field Values

ALLOW_JAVA_ENCODINGS

protected static final String ALLOW_JAVA_ENCODINGS
Feature identifier: allow java encodings

See Also:
Constant Field Values

CONTINUE_AFTER_FATAL_ERROR

protected static final String CONTINUE_AFTER_FATAL_ERROR
Feature identifier: continue after fatal error

See Also:
Constant Field Values

STANDARD_URI_CONFORMANT_FEATURE

protected static final String STANDARD_URI_CONFORMANT_FEATURE
Feature identifier: allow java encodings

See Also:
Constant Field Values

DISALLOW_DOCTYPE

protected static final String DISALLOW_DOCTYPE
Feature: disallow doctype

See Also:
Constant Field Values

GENERATE_SYNTHETIC_ANNOTATIONS

protected static final String GENERATE_SYNTHETIC_ANNOTATIONS
Feature: generate synthetic annotations

See Also:
Constant Field Values

VALIDATE_ANNOTATIONS

protected static final String VALIDATE_ANNOTATIONS
Feature identifier: validate annotations.

See Also:
Constant Field Values

HONOUR_ALL_SCHEMALOCATIONS

protected static final String HONOUR_ALL_SCHEMALOCATIONS
Feature identifier: honour all schemaLocations

See Also:
Constant Field Values

NAMESPACE_GROWTH

protected static final String NAMESPACE_GROWTH
Feature identifier: namespace growth

See Also:
Constant Field Values

TOLERATE_DUPLICATES

protected static final String TOLERATE_DUPLICATES
Feature identifier: tolerate duplicates

See Also:
Constant Field Values

STRING_INTERNING

protected static final String STRING_INTERNING
Feature identifier: string interning.

See Also:
Constant Field Values

ERROR_HANDLER

protected static final String ERROR_HANDLER
Property identifier: error handler.

See Also:
Constant Field Values

JAXP_SCHEMA_SOURCE

protected static final String JAXP_SCHEMA_SOURCE
Property identifier: JAXP schema source.

See Also:
Constant Field Values

ENTITY_RESOLVER

public static final String ENTITY_RESOLVER
Property identifier: entity resolver.

See Also:
Constant Field Values

ENTITY_MANAGER

protected static final String ENTITY_MANAGER
Property identifier: entity manager.

See Also:
Constant Field Values

ERROR_REPORTER

public static final String ERROR_REPORTER
Property identifier: error reporter.

See Also:
Constant Field Values

XMLGRAMMAR_POOL

public static final String XMLGRAMMAR_POOL
Property identifier: grammar pool.

See Also:
Constant Field Values

SYMBOL_TABLE

public static final String SYMBOL_TABLE
Property identifier: symbol table.

See Also:
Constant Field Values

SECURITY_MANAGER

protected static final String SECURITY_MANAGER
Property identifier: security manager.

See Also:
Constant Field Values

LOCALE

protected static final String LOCALE
Property identifier: locale.

See Also:
Constant Field Values

DEBUG_NODE_POOL

protected static final boolean DEBUG_NODE_POOL
See Also:
Constant Field Values

REDEF_IDENTIFIER

public static final String REDEF_IDENTIFIER
See Also:
Constant Field Values

fNotationRegistry

protected Hashtable fNotationRegistry

fDeclPool

protected XSDeclarationPool fDeclPool
Constructor Detail

XSDHandler

public XSDHandler()

XSDHandler

public XSDHandler(XSGrammarBucket gBucket)
Method Detail

parseSchema

public SchemaGrammar parseSchema(XMLInputSource is,
                                 XSDDescription desc,
                                 Hashtable locationPairs)
                          throws IOException
This method initiates the parse of a schema. It will likely be called from the Validator and it will make the resulting grammar available; it returns a reference to this object just in case. A reset(XMLComponentManager) must be called before this methods is called.

Parameters:
is -
desc -
locationPairs -
Returns:
the SchemaGrammar
Throws:
IOException

findGrammar

protected SchemaGrammar findGrammar(XSDDescription desc,
                                    boolean ignoreConflict)
First try to find a grammar in the bucket, if failed, consult the grammar pool. If a grammar is found in the pool, then add it (and all imported ones) into the bucket.


constructTrees

protected org.apache.xerces.impl.xs.traversers.XSDocumentInfo constructTrees(Element schemaRoot,
                                                                             String locationHint,
                                                                             XSDDescription desc,
                                                                             boolean nsCollision)

buildGlobalNameRegistries

protected void buildGlobalNameRegistries()

traverseSchemas

protected void traverseSchemas(ArrayList annotationInfo)

getGlobalDecl

protected Object getGlobalDecl(org.apache.xerces.impl.xs.traversers.XSDocumentInfo currSchema,
                               int declType,
                               QName declToTraverse,
                               Element elmNode)

getGlobalDecl

protected Object getGlobalDecl(String declKey,
                               int declType)

getGlobalDeclFromGrammar

protected Object getGlobalDeclFromGrammar(SchemaGrammar sGrammar,
                                          int declType,
                                          String localpart)

getGlobalDeclFromGrammar

protected Object getGlobalDeclFromGrammar(SchemaGrammar sGrammar,
                                          int declType,
                                          String localpart,
                                          String schemaLoc)

traverseGlobalDecl

protected Object traverseGlobalDecl(int declType,
                                    Element decl,
                                    org.apache.xerces.impl.xs.traversers.XSDocumentInfo schemaDoc,
                                    SchemaGrammar grammar)

schemaDocument2SystemId

public String schemaDocument2SystemId(org.apache.xerces.impl.xs.traversers.XSDocumentInfo schemaDoc)

resolveKeyRefs

protected void resolveKeyRefs()

getIDRegistry

protected Hashtable getIDRegistry()

getIDRegistry_sub

protected Hashtable getIDRegistry_sub()

storeKeyRef

protected void storeKeyRef(Element keyrefToStore,
                           org.apache.xerces.impl.xs.traversers.XSDocumentInfo schemaDoc,
                           XSElementDecl currElemDecl)

setDeclPool

public void setDeclPool(XSDeclarationPool declPool)

setDVFactory

public void setDVFactory(SchemaDVFactory dvFactory)

reset

public void reset(XMLComponentManager componentManager)

element2Locator

public SimpleLocator element2Locator(Element e)
Extract location information from an Element node, and create a new SimpleLocator object from such information. Returning null means no information can be retrieved from the element.


element2Locator

public boolean element2Locator(Element e,
                               SimpleLocator l)
Extract location information from an Element node, store such information in the passed-in SimpleLocator object, then return true. Returning false means can't extract or store such information.


setGenerateSyntheticAnnotations

public void setGenerateSyntheticAnnotations(boolean state)
Parameters:
state -


Copyright © 2011. All Rights Reserved.