General XMetaL Discussion
XMetaL Community Forum › General XMetaL Discussion › ID List Retrieval
-
scotth August 3, 2011 at 2:02 pm
ID List Retrieval
August 3, 2011 at 2:02 pmParticipants 0Replies 1Last Activity 11 years, 6 months agoUsing 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”);
Thanks,
Scott
Derek Read August 4, 2011 at 6:45 am
Reply to: ID List Retrieval
August 4, 2011 at 6:45 amIt 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.
-
AuthorPosts
- You must be logged in to reply to this topic.