General XMetaL Discussion

XMetaL Community Forum General XMetaL Discussion Am i missing something in this Xpath?

  • russurquhart1

    Am i missing something in this Xpath?

    Participants 2
    Replies 3
    Last Activity 13 years, 2 months ago

    Hi,

    i am trying to use the following snippet to find any/all elements that have a filter attribute set to the value 'filter5':

        var nodelist = ActiveDocument.getNodesByXpath(“*[@filter='filter5']”); 

    There are elements that meet this criteria in the file, but it keeps returning 0?

    Am I missing something?

    Thanks,

    Russ

    Reply

    Derek Read

    Reply to: Am i missing something in this Xpath?

    Try this:

    var nodelist = ActiveDocument.getNodesByXpath("//*[@filter='filter5']");

    Reply

    Derek Read

    Reply to: Am i missing something in this Xpath?

    I see the documentation in the Programmer's Guide is misleading in this instance (or we have strayed from the initial design of that API) which states that the path should be relative to the document's “DOMDocument” node (the document's root node). I'll follow this up with development.

    Reply

    russurquhart1

    Reply to: Am i missing something in this Xpath?

    I figured this out, right after i posted it, but thanks for the clarification!

    Thanks,

    Russ

    Reply

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

Lost Your Password?

Products
Downloads
Support