[ http://nagoya.apache.org/jira/browse/XERCESC-1003?page=history ]
Alberto Massari updated XERCESC-1003: ------------------------------------- Priority: Major > getElementById() returns element instance outside document tree > --------------------------------------------------------------- > > Key: XERCESC-1003 > URL: http://nagoya.apache.org/jira/browse/XERCESC-1003 > Project: Xerces-C++ > Type: Bug > Components: DOM > Versions: 2.3.0 > Environment: Operating System: Linux > Platform: PC > Reporter: Richard Jones > Assignee: Xerces-C Developers Mailing List > Attachments: AbstractDOMParser.diff > > I have a document that uses entity references as a means to include xml from > other files. I turn on validation and make sure that it is > working by temporarily misspelling a tag in the document and looking for error > messages during parseURI(). Now I set doNamespaces to true, > CreateEntityReferenceNodes to false and parse my document with validation. This > completes without errors. If I walk the DOM tree I can see that it is all > correct, with the entity expansion performed, as expected > Now I want to generate another view of the tree that requires me to follow > IDREFs within my document. Most of the time, the node returned by > getElementById() is the correct target node within the tree, but sometimes (4 > times out of many in my example below) it returns instead a node which > appears to be a clone of the actual target, but turns out to live on a > disconnected tree segement with a entity reference as its top parent. > This does not seem like the expected behavior. The problem only happens in a > tiny minority of calls to getElementById(). The following data will help > reproduce the problem. > xerces-c build: from xerces-c-src_2_3_0 using > runConfigure -plinux -cgcc -xg++ -minmem -nsocket -tnative -rpthread > gcc version 2.96 20000731 (Red Hat Linux 7.3 2.96-110) > glibc-2.2.5-42 > (build was successful) > User method for parsing was copied from samples/DOMPrint (XercesDOMParser). > Using DOMBuilder (samples/DOMCount) gives same result. > Test document: http://zeus.phys.uconn.edu/halld/geometry/main_HDDS.xml with DTD > served from same site. > Method to reproduce: > 1. Parse the document (either XercesDOMParser or DOMBuilder) with validation, > namespaces on, but entityReferenceNodes off; > 2. DOMNode* isolatedNode = getElementById(X("CDSI")); > 3. while (isolatedNode = isolatedNode->getParentNode()) { cout << > isolatedNode->getNodeType() << " " << endl; } > 4. note that the top parent has type ENTITY_REFERENCE (5) and not DOCUMENT (9) > 5. repeat with IDs ("STRAW", "DC1", "DC2", ...) and see that > doc->getElementById() returns a member of the *doc tree. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://nagoya.apache.org/jira/secure/Administrators.jspa - If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]