Pages: 1
Print
Author Topic: Am i missing something in this Xpath?  (Read 2075 times)
russurquhart1
Member

Posts: 25


« on: May 04, 2009, 02:25:58 PM »

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
Logged
Derek Read
Program Manager (XMetaL)
Administrator
Member

Posts: 1548



WWW
« Reply #1 on: May 04, 2009, 02:38:26 PM »

Try this:

var nodelist = ActiveDocument.getNodesByXpath("//*[@filter='filter5']");
Logged
Derek Read
Program Manager (XMetaL)
Administrator
Member

Posts: 1548



WWW
« Reply #2 on: May 04, 2009, 02:45:35 PM »

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.
Logged
russurquhart1
Member

Posts: 25


« Reply #3 on: May 04, 2009, 02:47:45 PM »

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

Thanks,


Russ
Logged
Pages: 1
Print
Jump to:  

email us