‎2008 Nov 05 10:59 AM
I have just started to use the XML DOM API. One thing I cannot see yet is an easy way to use XPath to get the value of an element.
What I would like to do is pass an XPath expression like this:
\EDIFACT\ORDERS\NAD[2]\NAD01\NAD0102
into a method, and get the value of the element returned to me.
Does anybody know if there is a method of one of the DOM interfaces that would provide that kind of functionality, or am I going to have to traverse the nodes of the DOM tree manually to do this?
BR,
Tony.
‎2008 Nov 21 2:59 PM
Hi Tony,
I read your posted question - I have the same problem.
I think that the method find_from_path_ns (or find_from_path) is the only "xpath"-like way to get a value.
BUT the syntax is very limited so you cannot use all good features of xpath
To traverse the nodes manually is (in my problem) unpractible - the xml-structures are different and it's horrible to traverse the tree.
I need xpaths like ' //x/y[3]/z[a='MS']' . I know, the performance is not very good but for small XML-messages fast enough
Do you have any solutions?
regards
Wolfgang Hummel
‎2008 Nov 21 3:14 PM
Hi,
Yes, I do have a solution, but I had to write my own code to do it. It works for me, but may not give you all the functionality that you want.
I want to post the result in a blog that I am trying to create withing the next week. I'll post a link here when it is done. The source code will be included.
BR,
Tony.
‎2013 Dec 27 11:46 AM
Hi,
do you know if SAP improve the path specification. I would like to read XML nodes with path like Document/CstmrPmtStsRpt/OrgnlPmtInfAndSts[n] with function FIND_FROM_PATH and for the momento is imposible.
BR,
MarÃa