Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Xpath Help,

Status
Not open for further replies.

HeeroFCC

Programmer
Sep 13, 2007
1
CA
Hi all,

Ack I feel dumb asking this question, but I can't seem to get the proper x-path expression for this xml. Here it is:

------

<?xml version="1.0" encoding="utf-8"?>
<SOAP-ENV:Envelope SOAP-ENV:encodingStyle=" xmlns:SOAP-ENC=" xmlns:xsi=" xmlns:SOAP-ENV=" xmlns:xsd="<SOAP-ENV:Body>
<namesp1:get_genes_by_pathwayResponse xmlns:namesp1="SOAP/KEGG">
<return SOAP-ENC:arrayType="xsd:string[25]" xsi:type="SOAP-ENC:Array" xmlns:r="SOAP/KEGG">
<item xsi:type="xsd:string">hsa:2203</item>
<item xsi:type="xsd:string">hsa:221823</item><item xsi:type="xsd:string">hsa:226</item><item xsi:type="xsd:string">hsa:229</item><item xsi:type="xsd:string">hsa:22934</item><item xsi:type="xsd:string">hsa:230</item><item xsi:type="xsd:string">hsa:2539</item><item xsi:type="xsd:string">hsa:25796</item><item xsi:type="xsd:string">hsa:2821</item><item xsi:type="xsd:string">hsa:51071</item><item xsi:type="xsd:string">hsa:5211</item><item xsi:type="xsd:string">hsa:5213</item><item xsi:type="xsd:string">hsa:5214</item><item xsi:type="xsd:string">hsa:5226</item><item xsi:type="xsd:string">hsa:5236</item><item xsi:type="xsd:string">hsa:5238</item><item xsi:type="xsd:string">hsa:5631</item><item xsi:type="xsd:string">hsa:5634</item><item xsi:type="xsd:string">hsa:6120</item><item xsi:type="xsd:string">hsa:64080</item><item xsi:type="xsd:string">hsa:6888</item><item xsi:type="xsd:string">hsa:7086</item><item xsi:type="xsd:string">hsa:84076</item><item xsi:type="xsd:string">hsa:8789</item><item xsi:type="xsd:string">hsa:9563</item></return></namesp1:get_genes_by_pathwayResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>

------

Basically, i want to get the values out of the item nodes, but i can't seem to figure out the x-path expressions because of the namespaces. I've tried like everything.

Can anyone help me?

Thanks
 
Here is the really wordy XPath expression for specifying all the <item> elements in a nodeset:
Code:
/*[local-name()='Envelope' and namespace-uri()='[URL unfurl="true"]http://schemas.xmlsoap.org/soap/envelope/'[/URL]]/*[local-name()='Body' and namespace-uri()='[URL unfurl="true"]http://schemas.xmlsoap.org/soap/envelope/'[/URL]][1]/*[local-name()='get_genes_by_pathwayResponse' and namespace-uri()='SOAP/KEGG'][1]/return[1]/item
There quite possibly is a shorter way of specifying what you want but your statement, "i want to get the values out of the item nodes," is not very specific.

Tom Morrison
 
Make sure you specify the namespaces in the XSL:
Code:
/SOAP-ENV:Envelope/SOAP-ENV:Body/namesp1:get_genes_by_pathwayResponse/return/item
Or if you wanted you could just do //item, but that will search every node and can be slow for large documents.

Jon

"I don't regret this, but I both rue and lament it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top