org.apache.xerces.impl.xs.traversers

Class XSDHandler


public class XSDHandler
extends java.lang.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,v 1.92 2005/06/24 17:56:41 mrglavas Exp $
Authors:
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 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.
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
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
protected XSDeclarationPool
fDeclPool
protected Hashtable
fNotationRegistry

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)
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)
First try to find a grammar in the bucket, if failed, consult the grammar pool.
protected Object
getGlobalDecl(org.apache.xerces.impl.xs.traversers.XSDocumentInfo currSchema, int declType, org.apache.xerces.xni.QName declToTraverse, Element elmNode)
protected Hashtable
getIDRegistry()
protected Hashtable
getIDRegistry_sub()
SchemaGrammar
parseSchema(org.apache.xerces.xni.parser.XMLInputSource is, XSDDescription desc, Hashtable locationPairs)
This method initiates the parse of a schema.
void
reset(org.apache.xerces.xni.parser.XMLComponentManager componentManager)
protected void
resolveKeyRefs()
void
setDeclPool(XSDeclarationPool declPool)
void
setGenerateSyntheticAnnotations(boolean state)
protected void
storeKeyRef(Element keyrefToStore, org.apache.xerces.impl.xs.traversers.XSDocumentInfo schemaDoc, XSElementDecl currElemDecl)
protected void
traverseSchemas(ArrayList annotationInfo)

Field Details

ALLOW_JAVA_ENCODINGS

protected static final String ALLOW_JAVA_ENCODINGS
Feature identifier: allow java encodings

CONTINUE_AFTER_FATAL_ERROR

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

DEBUG_NODE_POOL

protected static final boolean DEBUG_NODE_POOL
Field Value:
false

DISALLOW_DOCTYPE

protected static final String DISALLOW_DOCTYPE
Feature: disallow doctype

ENTITY_MANAGER

protected static final String ENTITY_MANAGER
Property identifier: entity manager.

ENTITY_RESOLVER

public static final String ENTITY_RESOLVER
Property identifier: entity resolver.

ERROR_HANDLER

protected static final String ERROR_HANDLER
Property identifier: error handler.

ERROR_REPORTER

public static final String ERROR_REPORTER
Property identifier: error reporter.

GENERATE_SYNTHETIC_ANNOTATIONS

protected static final String GENERATE_SYNTHETIC_ANNOTATIONS
Feature: generate synthetic annotations

HONOUR_ALL_SCHEMALOCATIONS

protected static final String HONOUR_ALL_SCHEMALOCATIONS
Feature identifier: honour all schemaLocations

JAXP_SCHEMA_SOURCE

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

REDEF_IDENTIFIER

public static final String REDEF_IDENTIFIER

SECURITY_MANAGER

protected static final String SECURITY_MANAGER
Property identifier: security manager.

STANDARD_URI_CONFORMANT_FEATURE

protected static final String STANDARD_URI_CONFORMANT_FEATURE
Feature identifier: allow java encodings

STRING_INTERNING

protected static final String STRING_INTERNING
Feature identifier: string interning.

SYMBOL_TABLE

public static final String SYMBOL_TABLE
Property identifier: symbol table.

VALIDATE_ANNOTATIONS

protected static final String VALIDATE_ANNOTATIONS
Feature identifier: validate annotations.

VALIDATION

protected static final String VALIDATION
Feature identifier: validation.

XMLGRAMMAR_POOL

public static final String XMLGRAMMAR_POOL
Property identifier: grammar pool.

XMLSCHEMA_VALIDATION

protected static final String XMLSCHEMA_VALIDATION
feature identifier: XML Schema validation

fDeclPool

protected XSDeclarationPool fDeclPool

fNotationRegistry

protected Hashtable fNotationRegistry

Constructor Details

XSDHandler

public XSDHandler()

XSDHandler

public XSDHandler(XSGrammarBucket gBucket)

Method Details

buildGlobalNameRegistries

protected void buildGlobalNameRegistries()

constructTrees

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

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.

findGrammar

protected SchemaGrammar findGrammar(XSDDescription desc)
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.

getGlobalDecl

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

getIDRegistry

protected Hashtable getIDRegistry()

getIDRegistry_sub

protected Hashtable getIDRegistry_sub()

parseSchema

public SchemaGrammar parseSchema(org.apache.xerces.xni.parser.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:

reset

public void reset(org.apache.xerces.xni.parser.XMLComponentManager componentManager)

resolveKeyRefs

protected void resolveKeyRefs()

setDeclPool

public void setDeclPool(XSDeclarationPool declPool)

setGenerateSyntheticAnnotations

public void setGenerateSyntheticAnnotations(boolean state)
Parameters:
state -

storeKeyRef

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

traverseSchemas

protected void traverseSchemas(ArrayList annotationInfo)

Copyright B) 1999-2005 Apache XML Project. All Rights Reserved.