[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message]

request: get the attribute value

Markus Pilman mpilman at student.ethz.ch
Wed Sep 2 14:08:46 PDT 2009


  request: get the attribute value
> But when I want to get value of attribute "sawsdl:modelReference", I use the
> query
>
> for $x in
> doc(\"aa.wsdl\")/wsdl:definitions/wsdl:types/xsd:schema/xsd:complexType
> return <node>{$x/@sawsdl:modelReference}</node>
>
> It returns nothing. How could I get the value of the attribute "
> sawsdl:modelReference"?
Only to be sure about that: did you declare the namespace? You would
do that by adding the line

declare namespace sawsdl="http://www.w3.org/ns/sawsdl";

As an alternative you could use the query

for $x in doc(\"aa.wsdl\")/wsdl:definitions/wsdl:types/xsd:schema/xsd:complexType
return <node>{$x/@*:modelReference}</node>

which looks for attributes "modelReference" in all namespaces.

Markus

On Wed, Sep 2, 2009 at 12:36 PM, dengping wei<http://x-query.com/mailman/listinfo/talk> wrote:
> Dear all,
>
> I have a question when I using xquery the get the attribute value of an
> element.
>
> when my query is
> for $x in doc(\"aa.wsdl\")/wsdl:
> definitions/wsdl:types/xsd:schema/xsd:complexType
> return <node>{$x}</node>
> It returns the results as follows:
> <node>
>    <xsd:complexType xmlns:tns="http://schemas.dmas.dfki.de/venetianblind"
>                     xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
>
> xmlns:impl="http://dmas.dfki.de/axis/services/CarPrice-impl"
>                     xmlns:sawsdl="http://www.w3.org/ns/sawsdl"
>
> xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
>                     xmlns:intf="http://dmas.dfki.de/axis/services/CarPrice"
>                     xmlns:apachesoap="http://xml.apache.org/xml-soap"
>                     xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
>                     xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>                     xmlns="http://dmas.dfki.de/axis/services/CarPrice"
>                     name="PriceType"
>
> sawsdl:modelReference="http://127.0.0.1/ontology/concept.owl#Price">
>         <xsd:sequence>
>           <xsd:element name="currency" type="Currency"/>
>           <xsd:element name="amount" type="xsd:float"/>
>         </xsd:sequence>
>       </xsd:complexType>
> </node>
>
> Then I want to get the value of attribute "name", I use the query
> for $x in
> doc(\"aa.wsdl\")/wsdl:definitions/wsdl:types/xsd:schema/xsd:complexType
> return <node>{$x/@name}</node>
>
> It works and return the results: <node name="PriceType"/>
>
> But when I want to get value of attribute "sawsdl:modelReference", I use the
> query
>
> for $x in
> doc(\"aa.wsdl\")/wsdl:definitions/wsdl:types/xsd:schema/xsd:complexType
> return <node>{$x/@sawsdl:modelReference}</node>
>
> It returns nothing. How could I get the value of the attribute "
> sawsdl:modelReference"?
>
> Thanks very much.
>
>
>
> --
> Dengping WEI
> School of Computer Science,
> National University of Defense Technology,
> Changsha, Hunan  410073
> P.R. China
>
> _______________________________________________
> http://x-query.com/mailman/listinfo/talk
> http://x-query.com/mailman/listinfo/talk
>



PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.