XMLInputSource is = new XMLInputSource(docType.getPublicId(), docType.getSystemId(), null);
if(internalSubset != null)
is.setCharacterStream(new StringReader(internalSubset));
try {
DTDGrammar g = (DTDGrammar)preParser.preparseGrammar(XMLGrammarDescription.XML_DTD, is);
((XMLDTDDescription)g.getGrammarDescription()).setRootName(docType.getName());
is.setCharacterStream(null);
g = (DTDGrammar)preParser.preparseGrammar(XMLGrammarDescription.XML_DTD, is);
((XMLDTDDescription)g.getGrammarDescription()).setRootName(docType.getName());