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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

help simplify xpath expression

Status
Not open for further replies.

ddiamond

Programmer
Apr 22, 2005
918
US
I'm attempt to create an xpath expression that will return the value of the soapAction attribute for a given operation within a WSDL file. Here is a piece of the WSDL file:

<wsdl:eek:peration name="ProcessNA">
<soap:eek:peration soapAction=" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:eek:utput>
<soap:body use="literal" />
</wsdl:eek:utput>
</wsdl:eek:peration>

The following xpath expression does return the soapAction attribute, but it is messy. I'm wondering if anyone can come up with a cleaner xpath expression that does the same thing.

//wsdl:eek:peration[@name='ProcessNA']/*[@soapAction!='']/@soapAction
 
It is not messy at all, but rather precise!

This XPath expression specifies a nodeset containing attribute nodes [ul][li]with the name 'soapAction' which are subordinate to[/li][li]an element node (of any name) that contains a nonempty soapAction attribute, and which is subordinate to[/li][li]an element named operation with the namespace alias wsdl that also contains an attributed named name the value of which is ProcessNA.[/li][/ul]


Which if these constraints would you wish to omit? If you can safely omit a constraint, then the expression could be simplified.

Tom Morrison
 
Well, I don't really care if the soapAction attribute is empty, only that it exists. So I could get rid of !=''.

//wsdl:eek:peration[@name='ProcessNA']/*[@soapAction]/@soapAction
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top