General XMetaL Discussion
scotth August 3, 2011 at 2:02 pm
ID List RetrievalAugust 3, 2011 at 2:02 pmParticipants 0Replies 1Last Activity 11 years, 1 month ago
Using XMetaL 6.0, what is the most efficient way to retrieve a list of all ID attribute values in the document? Below is what I am currently doing. I was just curious if there is a better way.
XMetaLControlLib.DOMNodeList idNodes = _xHost.Document.NativeObject.getNodesByXPath(“//@id”);
ScottDerek Read August 4, 2011 at 6:45 am
Reply to: ID List RetrievalAugust 4, 2011 at 6:45 am
It depends on what you need to do with this information afterwards. If you need to visit each node to change it in some way it can be more efficient to walk the document element by element (there are various APIs for moving between nodes or elements) and check each for an @ID. If you just need to gather the list of nodes for use elsewhere then getNodesByXPath may be more efficient.
- You must be logged in to reply to this topic.