![]() |
![]() | ![]() | ![]() | Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - XPath and namespaces... >Thread Next - Re:still problems with XPath and namespaces... Re: XPath and namespaces...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/ | ![]() | ![]() | ![]() |
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | |||||
|
