[ https://issues.apache.org/jira/browse/XERCESC-1003?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Scott Cantor resolved XERCESC-1003. ----------------------------------- Resolution: Fixed This seems to have been applied in some form in 3.x. > getElementById() returns element instance outside document tree > --------------------------------------------------------------- > > Key: XERCESC-1003 > URL: https://issues.apache.org/jira/browse/XERCESC-1003 > Project: Xerces-C++ > Issue Type: Bug > Components: DOM > Affects Versions: 2.3.0 > Environment: Operating System: Linux > Platform: PC > Reporter: Richard Jones > Attachments: ASF.LICENSE.NOT.GRANTED--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 was sent by Atlassian JIRA (v6.4.14#64029) --------------------------------------------------------------------- To unsubscribe, e-mail: c-dev-unsubscr...@xerces.apache.org For additional commands, e-mail: c-dev-h...@xerces.apache.org