Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: XPath and namespaces...

From: Martin Honnen <mahotrash@-----.-->
To: NULL
Date: 1/2/2005 5:16:00 PM

Stefan Franke wrote:


> I've got a little bit of a problem when dealing with namespaces and XPath.
> 
> I'm trying very basic things, like showing all the nodes of one particular 
> namespace. Here is my XPath statement:
> //*[local-name() = 'buch' and namespace-uri() = 
> 'http://www.example.com/buecher']
> 
> Unfortunately this doesn't work. 

What do you mean by "doesn't work"? Do you get an error? Which software 
are you using to test that XPath expression?


> My XML file looks like this:
> 
> <?xml version="1.0"?>
> <!-- Dateiname: Sammlung.xml -->
> <SAMMLUNG
>    xmlns:buch="http://www.example.com/buecher"
>    xmlns:cd="http://www.example.com/cds">
> 
>    <buch:ARTIKEL Status="vorhanden">
>       <buch:TITEL>The Adventures of Huckleberry Finn</buch:TITEL>
>       <buch:AUTOR>Mark Twain</buch:AUTOR>
>       <buch:PREIS>12.75</buch:PREIS>
>    </buch:ARTIKEL>
>    <cd:ARTIKEL>
>       <cd:TITEL>Violinkonzert D-Dur</cd:TITEL>
>       <cd:KOMPONIST>Beethoven</cd:KOMPONIST>
>       <cd:PREIS>14.95</cd:PREIS>
>    </cd:ARTIKEL>
> </SAMMLUNG>

Well looking at your example XML the expression

//*[local-name() = 'buch' and namespace-uri() =
'http://www.example.com/buecher']

will not find any element as the XML doesn't contain any
   <buch xmlns="http://www.example.com/buecher" />
elements, perhaps you are looking for

//*[local-name() = 'ARTIKEL' and namespace-uri() = 
'http://www.example.com/buecher']


-- 

	Martin Honnen
	http://JavaScript.FAQTs.com/


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent