Pages: 1
Print
Author Topic: ID List Retrieval  (Read 240 times)
scotth
Member

Posts: 35


« on: August 03, 2011, 08:02:28 AM »

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");

Thanks,

Scott
Logged
Derek Read
Program Manager (XMetaL)
Administrator
Member

Posts: 1548



WWW
« Reply #1 on: August 04, 2011, 12:45:28 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.
Logged
Pages: 1
Print
Jump to:  

email us