public SchemaGrammar parseSchema(XMLInputSource is, XSDDescription desc) {  String schemaNamespace = desc.getTargetNamespace();  if (schemaNamespace != null) { schemaNamespace = fSymbolTable.addSymbol(schemaNamespace);
public SchemaGrammar parseSchema(XSDDescription desc) { XMLInputSource schemaSource=null; fDOMPool.reset(); fSchemaParser.setPool(fDOMPool); try { schemaSource = fLocationResolver.resolveEntity(desc);
    public SchemaGrammar parseSchema(XMLInputSource is, XSDDescription desc) {        String schemaNamespace = desc.getTargetNamespace();        // handle empty string URI as null        if (schemaNamespace != null) {            schemaNamespace = fSymbolTable.addSymbol(schemaNamespace);        }        short referType = desc.getContextType();                // before parsing a schema, need to reset all traversers and        // clear all registries        prepare();                // first phase:  construct trees.        Document schemaRoot = getSchema(schemaNamespace, is,                                        referType == XSDDescription.CONTEXT_PREPARSE,                                        referType, null);        if (schemaRoot == null) {            // something went wrong right off the hop            return null;        }        fRoot = constructTrees(schemaRoot, is.getSystemId(), desc);        if (fRoot == null) {            return fGrammarBucket.getGrammar(schemaNamespace);        }        // second phase:  fill global registries.        buildGlobalNameRegistries();        // third phase:  call traversers        traverseSchemas();        // fourth phase: handle local element decls        traverseLocalElements();        // fifth phase:  handle Keyrefs        resolveKeyRefs();        // sixth phase: validate attribute of non-schema namespaces        // REVISIT: skip this for now. we really don't want to do it.        //fAttributeChecker.checkNonSchemaAttributes(fGrammarBucket);        // for all grammars with <import>s        for (int i = fAllTNSs.size() - 1; i >= 0; i--) {            // get its target namespace            String tns = (String)fAllTNSs.elementAt(i);            // get all namespaces it imports            Vector ins = (Vector)fImportMap.get(tns);            // get the grammar            SchemaGrammar sg = fGrammarBucket.getGrammar(emptyString2Null(tns));            if (sg == null)                continue;            SchemaGrammar isg;            // for imported namespace            int count = 0;            for (int j = 0; j < ins.size(); j++) {                // get imported grammar                isg = fGrammarBucket.getGrammar((String)ins.elementAt(j));                // reuse the same vector                if (isg != null)                    ins.setElementAt(isg, count++);            }            ins.setSize(count);            // set the imported grammars            sg.setImportedGrammars(ins);        }        // and return.        return fGrammarBucket.getGrammar(schemaNamespace);    } // end parseSchema