Iterator nsiter = inlineNSs.iterator();
while(nsiter.hasNext())
{
XSDDescription desc = new XSDDescription();
desc.setNamespace((String)nsiter.next());
Grammar oldGrammar = pool.removeGrammar(desc);
if(oldGrammar != null)
oldGrammars.add(oldGrammar);
}
}
// get the input source for an external schema file
else
{
is = new XMLInputSource(null,schema,schema);
}
XSGrammar grammar = (XSGrammar)grammarPreparser.preparseGrammar(XMLGrammarDescription.XML_SCHEMA,is);
xsModel = grammar.toXSModel();
// Here we add the temporiliy removed schema back.
if (inlineXSD && oldGrammars != null)
{
XSDDescription description = new XSDDescription();
description.setNamespace(targetNamespace);
pool.removeGrammar(description);
Set inlineNSs = ((InlineXSDResolver)inlineSchemaEntityResolver).getInlineSchemaNSs();
Iterator nsiter = inlineNSs.iterator();
while(nsiter.hasNext())
{
XSDDescription desc = new XSDDescription();
desc.setNamespace((String)nsiter.next());
pool.removeGrammar(desc);
}
Iterator oldGIter = oldGrammars.iterator();
while(oldGIter.hasNext())
{
Grammar oldGrammar = (Grammar)oldGIter.next();
if(oldGrammar != null)
pool.putGrammar(oldGrammar);
}
}
}