General XMetaL Discussion

  • scotth

    ID List Retrieval

    Participants 0
    Replies 1
    Last 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”);

    Thanks,

    Scott

    Reply

    Derek Read

    Reply to: ID List Retrieval

    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.

    Reply

  • You must be logged in to reply to this topic.

Lost Your Password?

Products
Downloads
Support