XQUERY and particular search

Discussion in 'XML' started by thinkmarco@yahoo.it, Jan 24, 2007.

  1. Guest

    Hi,
    I have this doubt that I expose with an example.
    I mark a lot of documents with the tag "city" and the attribute "nation".

    for example

    <xml>
    ...... bla bla bla
    ..... <CITY nation="England">London</CITY>
    ..... <CITY nation="USA">New York</CITY>
    ..... <CITY nation="France">Paris</CITY>
    ......
    ..... <CITY nation="Italy">Venice</CITY>
    .....
    </xml>

    In a second moment I want add a second attribute, for example type="sea"
    to indicate that the city is near to the sea. Some city could not have
    this attribute

    <xml>
    ...... bla bla bla
    ..... <CITY nation="England">London</CITY>
    ..... <CITY nation="USA" type="sea" >New York</CITY>
    ..... <CITY nation="France">Paris</CITY>
    ......
    ..... <CITY nation="Italy" type="sea" >Venice</CITY>
    .....
    </xml>

    My question is: can I use XQuery (or xpath) to search directly all the
    CITY where tha attribute "type" is not specified?

    Thanks in advance
    Marco Righi
    , Jan 24, 2007
    #1
    1. Advertising

  2. wrote:

    > My question is: can I use XQuery (or xpath) to search directly all the
    > CITY where tha attribute "type" is not specified?


    //CITY[not(@type))]


    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
    Martin Honnen, Jan 24, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ken North
    Replies:
    0
    Views:
    423
    Ken North
    Apr 17, 2004
  2. zheetee
    Replies:
    0
    Views:
    350
    zheetee
    Aug 5, 2004
  3. Abby Lee
    Replies:
    5
    Views:
    400
    Abby Lee
    Aug 2, 2004
  4. Toki Toki
    Replies:
    2
    Views:
    131
    Toki Toki
    May 2, 2008
  5. Replies:
    3
    Views:
    140
Loading...

Share This Page