Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Problems using if_ixml_document->find_from_path_ns

Former Member
0 Kudos

Hi,

I am trying to use this method to get to the right xml node. However this does not seem to be working. Does anybody know what I am doing wrong here. Any help is highly appreciated.

CALL METHOD document->find_from_path_ns

EXPORTING

default_uri = 'xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"'

path = '/soap:Envelope/soap:Body/child::node()'

receiving

rval = rval1

The xml document looks like this.

<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><GetStndAddressResponse xmlns="http://micron.com/AddrStnd/"><GetStndAddressResult><stdAddress>5811 N Cosworth Pl</stdAddress><stdZipCode>83713-1263</stdZipCode><stdState>ID</stdState><stdCity>Boise</stdCity></GetStndAddressResult></GetStndAddressResponse></soap:Body></soap:Envelope>

1 ACCEPTED SOLUTION

Former Member
0 Kudos

First, your default_uri should be just http://schemas.xmlsoap.org/soap/envelope/.

Second, I do not think the path parameter actually supports XPath syntax, from the documentation it seems to be much simpler than that. Besides, it seems that the default_uri actually works only on the first element in the path, which I believe is a bug.

So something like this should work:


CALL METHOD document->find_from_path_ns
EXPORTING
default_uri = 'http://schemas.xmlsoap.org/soap/envelope/'
path = '/Envelope/"http://schemas.xmlsoap.org/soap/envelope/:Body"/"http://micron.com/AddrStnd/:GetStndAddressResponse"'
receiving
rval = rval1

Notice the full namespace URI in front of the element names and double quotes around each qualified element name.

Full XPath functionality is possible with cl_xslt_processor class (set_expression and RUN( PROGNAME = '' ) methods), but it's kind of an undocumented feature.

1 REPLY 1

Former Member
0 Kudos

First, your default_uri should be just http://schemas.xmlsoap.org/soap/envelope/.

Second, I do not think the path parameter actually supports XPath syntax, from the documentation it seems to be much simpler than that. Besides, it seems that the default_uri actually works only on the first element in the path, which I believe is a bug.

So something like this should work:


CALL METHOD document->find_from_path_ns
EXPORTING
default_uri = 'http://schemas.xmlsoap.org/soap/envelope/'
path = '/Envelope/"http://schemas.xmlsoap.org/soap/envelope/:Body"/"http://micron.com/AddrStnd/:GetStndAddressResponse"'
receiving
rval = rval1

Notice the full namespace URI in front of the element names and double quotes around each qualified element name.

Full XPath functionality is possible with cl_xslt_processor class (set_expression and RUN( PROGNAME = '' ) methods), but it's kind of an undocumented feature.