Details
-
Bug
-
Status: Closed
-
Resolution: Fixed
-
2.4.0
-
None
-
None
-
Operating System: Linux
Platform: Other
-
26315
Description
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?