@Override public Grammar loadGrammar(XMLInputSource source) throws IOException, XNIException {
  reset();
  String eid=XMLEntityManager.expandSystemId(source.getSystemId(),source.getBaseSystemId(),fStrictURI);
  XMLDTDDescription desc=new XMLDTDDescription(source.getPublicId(),source.getSystemId(),source.getBaseSystemId(),eid,null);
  if (!fBalanceSyntaxTrees) {
    fDTDGrammar=new DTDGrammar(fSymbolTable,desc);
  }
 else {
    fDTDGrammar=new BalancedDTDGrammar(fSymbolTable,desc);
  }
  fGrammarBucket=new DTDGrammarBucket();
  fGrammarBucket.setStandalone(false);
  fGrammarBucket.setActiveGrammar(fDTDGrammar);
  try {
    fDTDScanner.setInputSource(source);
    fDTDScanner.scanDTDExternalSubset(true);
  }
 catch (  EOFException e) {
  }
 finally {
    fEntityManager.closeReaders();
  }
  if (fDTDGrammar != null && fGrammarPool != null) {
    fGrammarPool.cacheGrammars(XMLGrammarDescription.XML_DTD,new Grammar[]{fDTDGrammar});
  }
  return fDTDGrammar;
}

@ Override public Grammar loadGrammar ( XMLInputSource source ) throws IOException , XNIException { reset ( ) ; String eid = XMLEntityManager . expandSystemId ( source . getSystemId ( ) , source . getBaseSystemId ( ) , fStrictURI ) ; XMLDTDDescription desc = new XMLDTDDescription ( source . getPublicId ( ) , source . getSystemId ( ) , source . getBaseSystemId ( ) , eid , null ) ; if ( ! fBalanceSyntaxTrees ) { fDTDGrammar = new DTDGrammar ( fSymbolTable , desc ) ; } else { fDTDGrammar = new BalancedDTDGrammar ( fSymbolTable , desc ) ; } fGrammarBucket = new DTDGrammarBucket ( ) ; fGrammarBucket . setStandalone ( false ) ; fGrammarBucket . setActiveGrammar ( fDTDGrammar ) ; try { fDTDScanner . setInputSource ( source ) ; fDTDScanner . scanDTDExternalSubset ( true ) ; } catch ( EOFException e ) { } finally { fEntityManager . closeReaders ( ) ; } if ( fDTDGrammar != null && fGrammarPool != null ) { fGrammarPool . cacheGrammars ( XMLGrammarDescription . XML_DTD , new Grammar [ ] { fDTDGrammar } ) ; } return fDTDGrammar ; }
returns a grammar object by parsing the contents of the entity pointed to by source .
