Class 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$
    Author:
    Neil Graham, IBM, Pavani Mukthipudi, Sun Microsystems
    • Constructor Detail

      • XSDHandler

        public XSDHandler()
    • 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.smooks.engine.delivery.sax.ng.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.smooks.engine.delivery.sax.ng.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)
      • traverseGlobalDecl

        protected Object traverseGlobalDecl​(int declType,
                                            Element decl,
                                            org.smooks.engine.delivery.sax.ng.org.apache.xerces.impl.xs.traversers.XSDocumentInfo schemaDoc,
                                            SchemaGrammar grammar)
      • schemaDocument2SystemId

        public String schemaDocument2SystemId​(org.smooks.engine.delivery.sax.ng.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.smooks.engine.delivery.sax.ng.org.apache.xerces.impl.xs.traversers.XSDocumentInfo schemaDoc,
                                   XSElementDecl currElemDecl)
      • 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 -