Skip to main content
1-Visitor
December 18, 2015
Solved

Can I get children of current node by xpath

  • December 18, 2015
  • 3 replies
  • 2287 views

I'm trying to get children of current node by using xpath in APP source edit mode!

Can it be done in this way?

    Best answer by GarethOakes

    APP source edit mode = APP Javascript FOM

    The way to access the current node during formatting is: formatting.currentXMLNode

    Once you have an XML Node object you can run XPath against it: myNode.evaluateXPath("something")

    To access child elements in XPath: child::*

    So putting it all together: formatting.currentXMLNode.evaluateXPath("child::*")

    3 replies

    1-Visitor
    December 18, 2015

    I'm not sure what APP source edit mode is, but there is an acl function:  oid_xpath_nodeset_str(srcOid, xpath)

    I use this in conjunction with a helper acl method to make calls from java.

    See the archive at:  aclxpathhelperfunction - www2

    16-Pearl
    December 18, 2015

    APP source edit mode = APP Javascript FOM

    The way to access the current node during formatting is: formatting.currentXMLNode

    Once you have an XML Node object you can run XPath against it: myNode.evaluateXPath("something")

    To access child elements in XPath: child::*

    So putting it all together: formatting.currentXMLNode.evaluateXPath("child::*")

    5-Regular Member
    January 21, 2016

    Hey dr bd,

    Did Gareth's reply help you out?

    Let us know if you got it resolved, or need more assistance.  Thanks!