XPath filter on multiple attributes

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



I have the following XML:

<?xml version="1.0" encoding="UTF-8"?>
<SETTINGS>
<DATABASE NAME="DEMO" DESCRIPTION="Demo database">
<USER NAME="arnaud" />
</DATABASE>
<DATABASE NAME="TEST" DESCRIPTION="Test database">
<USER NAME="peter" DEFAULT="1" />
<USER NAME="arnaud" />
</DATABASE>
</SETTINGS>

What I want is to get the <DATABASE> node where the <USER
NAME="arnaud" DEFAULT="1">. So in the above XML there is non. But I
use the following XPath statement:

DATABASE[USER/@NAME = 'arnaud' and USER/@DEFAULT = '1']

And <DATABASE> TEST is returned. I expect that there is nothing to be
returned.

What do I wrong, I am new with XPATH.

Regards
Arnaud

.



Relevant Pages

  • xml xquery and php
    ... I am new to XML. ... Initially I was saving all the settings in either PHP ... from files or query from the database. ...
    (comp.text.xml)
  • xml xquery and php
    ... I am new to XML. ... Initially I was saving all the settings in either PHP ... from files or query from the database. ...
    (comp.lang.php)
  • Re: DISCOVER_XML_METADATA
    ... expansion of ASSL XML returned by the server. ... You could do ExpandObject for the server in step 1. ... you could request ExpandObject for that database -- this is step ... all cubes and nothing else. ...
    (microsoft.public.sqlserver.olap)
  • Re: Preservation of namespace prefixes in XML datatype
    ... representation well beyond merely preserving the logical meaning. ... > Now the ANSI/ISO SQL-2003 standard makes it pretty clear that the XML ... all the guarantee the database gives you is that we preserve the ... >> makes changes in namespace prefixes, will I the user/developer have the ...
    (microsoft.public.sqlserver.xml)
  • Re: Wanted:MAIL.MAI structure definition
    ... a relational database is more flexible in the retrival of data. ... Perhaps this impact has been softened as hardware has gotten faster, but, overhead is overhead, and if you weren't using the advances in hardware for overhead, those designs that have less overhead would also gain from the faster hardware. ... RFC822 header because your XML parser wouldn't be able to understand new ...
    (comp.os.vms)