I don't think there is any such thing yet. But you'd have to iterate the
tree and look for any IDREF or IDREFS attributes, parse out the names of
the referenced ids and match them to the string you are searching for.
----------------------------------------
Dean Roddey
Software Weenie
IBM Center for Java Technology - Silicon Valley
[EMAIL PROTECTED]
Jeff Lewis <[EMAIL PROTECTED]> on 02/09/2000 04:30:48 PM
Please respond to [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
cc:
Subject: DOM_NodeList DOM_Document::getElementsWhichReference( "ID.1")
Is there a way in Xerces-C to find-out which elements
reference an element with a given ID?
Example:
<? xml version="1.0" ?>
<!DOCTYPE DOC [
<!ELEMENT DOC (ITEM+,REFERENCES+)>
<!ELEMENT ITEM (#PCDATA)>
<!ATTLIST ITEM id ID #REQUIRED>
<!ELEMENT REFERENCES (#PCDATA)>
<!ATTLIST REFERENCES id ID #REQUIRED>
<!ATTLIST REFERENCES refID IDREF #REQUIRED>
]>
<DOC>
<ITEM id="ITM.1" />
<ITEM id="ITM.2" />
<REFERENCES id="REF.1" refID="ITM.1" />
<REFERENCES id="REF.2" refID="ITM.1" />
</DOC>
Basically, I want to get a list of REFERENCES which
point to a given ITEM.
DOM_NodeList nodes = doc.getElementsWhichReference(
"ITM.1" );
// nodes.getLength() should == 2
DOM_NodeList nodes = doc.getElementsWhichReference(
"ITM.2" );
// nodes.getLength() should == 0
If there isn't, could anyone lead me in the proper
direction for adding such functionality to Xerces-C DOM?
__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.com