73 lines
2.2 KiB
XML
73 lines
2.2 KiB
XML
|
<?xml version='1.0' encoding='utf-8'?>
|
||
|
<!DOCTYPE section [
|
||
|
<!ENTITY % myent SYSTEM "../entities.ent">
|
||
|
%myent;
|
||
|
]>
|
||
|
<section xmlns="http://docbook.org/ns/docbook" version="5.0"
|
||
|
xmlns:xi="http://www.w3.org/2001/XInclude">
|
||
|
<title>selectXPath</title>
|
||
|
<para>Selects xmlfragements, nodes, attribute or text from xml data using an XPath expression.
|
||
|
This function requires namespaces to be declared correctly.</para>
|
||
|
<para>
|
||
|
Sample request:
|
||
|
<programlisting language="xml"><![CDATA[
|
||
|
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
|
||
|
xmlns:ws="http://ws.xservices.brutex.net">
|
||
|
<soapenv:Header/>
|
||
|
<soapenv:Body>
|
||
|
<ws:selectXPath>
|
||
|
<sourcexml>
|
||
|
<![CDATA[<notes xmlns="http://demo.brutex.net" xmlns:bx="http://bx.brutex.net">
|
||
|
<bx:note>
|
||
|
<to>Lena</to>
|
||
|
<from>Jani</from>
|
||
|
<heading>Reminder ABC</heading>
|
||
|
<body>Don't forget me this weekend!</body>
|
||
|
</bx:note>
|
||
|
<note>
|
||
|
<to>John</to>
|
||
|
<from>Lena</from>
|
||
|
<heading>Call Mr. ABC</heading>
|
||
|
<body>Please call back</body>
|
||
|
</note>
|
||
|
<bx:note>
|
||
|
<to>Brian</to>
|
||
|
<from>JJohn</from>
|
||
|
<heading>Reminder XServices</heading>
|
||
|
<body>How to use selectXPath?</body>
|
||
|
</bx:note>
|
||
|
</notes>
|
||
|
]]]]><![CDATA[>
|
||
|
</sourcexml>
|
||
|
<encoding>utf-8</encoding>
|
||
|
<namespaceList>
|
||
|
<namespace>
|
||
|
<prefix>ns</prefix>
|
||
|
<uri>http://demo.brutex.net</uri>
|
||
|
</namespace>
|
||
|
<namespace>
|
||
|
<prefix>bx</prefix>
|
||
|
<uri>http://bx.brutex.net</uri>
|
||
|
</namespace>
|
||
|
</namespaceList>
|
||
|
<xpath>*/bx:note/ns:heading/text()</xpath>
|
||
|
</ws:selectXPath>
|
||
|
</soapenv:Body>
|
||
|
</soapenv:Envelope>
|
||
|
]]></programlisting>
|
||
|
Sample response:
|
||
|
<programlisting language="xml"><![CDATA[
|
||
|
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
|
||
|
<soap:Body>
|
||
|
<ns2:selectXPathResponse xmlns:ns2="http://ws.xservices.brutex.net">
|
||
|
<return>
|
||
|
<stringlist>Reminder ABC</stringlist>
|
||
|
<stringlist>Reminder XServices</stringlist>
|
||
|
<size>2</size>
|
||
|
</return>
|
||
|
</ns2:selectXPathResponse>
|
||
|
</soap:Body>
|
||
|
</soap:Envelope>
|
||
|
]]></programlisting>
|
||
|
</para>
|
||
|
</section>
|