DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26315>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26315 Caching DTD; duplicate root element when parsing DOCTYPE Summary: Caching DTD; duplicate root element when parsing DOCTYPE Product: Xerces-C++ Version: 2.4.0 Platform: Other OS/Version: Linux Status: NEW Severity: Major Priority: Other Component: Validating Parser (DTD) AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] After caching of an external DTD, when parsing XML files that refer to the external (cached) DTD, the first file is processed OK, but the second file complains about a duplicate element when parsing the DOCTYPE declaration. Also tried the Jan 20, 2004 nightly build, with the same results. This works fine with cached schemas, and seems to only be a problem with cached DTD. To test grammar caching, I modifed samples/DOMCount/DOMCount.cpp and added the following two lines: parser->setFeature(XMLUni::fgXercesCacheGrammerFromParse, true); parser->setFeature(XMLUni::fgXercesUseCacheGrammerInParse, true); I invoked DOMCount as follows: DOMCount -n -s -f -l filelist filelist contains the same XML file twice, i.e: 0-OrderRequest.xml 0-OrderRequest.xml The first file is parsed successfully. The second file has the following error: Fatal Error at file 0-OrderRequest.xml, line 6, char 15 Message: An exception occurred! Type:IllegalArgumentException, Message:The element cXML already exists line 6 of the file contains: <!DOCTYPE cXML SYSTEM "/home/jbosloy/example/cXML/cXML.dtd"> The parse is failing in IGXMLScanner::scanDocTypeDecl(): if(!fUseCachedGrammar) { ... } else { // attach this to the undeclared element pool so that it gets deleted rootDecl->setId(fDTDElemNonDeclPool->put((DTDElementDecl*)rootDecl)); } The only spot that I can find where fDTDElemNonDeclPool is ever emptied is in IGXMLScanner::loadDTDGrammer. So, the first time a document is parsed, the root element is put into the pool, and when the document is parsed a second time, the root element is put into the pool again and fails since it already exists. Is the fDTDElemNonDeclPool not supposed to have its contents removed after the handling of a document is complete? --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]