Re: XPath and default (overridden) namespaces
From: Oleg Tkachenko [MVP] (oleg_at_NO!SPAM!PLEASEtkachenko.com)
Date: 08/26/04
- Next message: Stephen: "Re: serialisation of classes to generate XMLDocument"
- Previous message: Oleg Tkachenko [MVP]: "Re: XPath: counting unique values"
- In reply to: Peter Theill: "XPath and default (overridden) namespaces"
- Next in thread: Peter Theill: "Re: XPath and default (overridden) namespaces"
- Reply: Peter Theill: "Re: XPath and default (overridden) namespaces"
- Reply: Oleg Tkachenko [MVP]: "Re: XPath and default (overridden) namespaces"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 26 Aug 2004 13:33:29 +0200
Peter Theill wrote:
> I need some help on XPath ... what's the expressions to get:
>
> 1. All "Employee" nodes?
You should realize that namespace is integral part of an element name,
so "All "Employee" nodes" actually makes little sense. You mean all
elements with local name "Employee"? Then use
/NorthwindEmployees/*[local-name='Employee']
> 2. Only "Employee" nodes from "urn:test1" namespace?
/NorthwindEmployees/foo:Employee
where foo prefix is bound to "urn:test1" namespace.
Or (usually machine-generated form)
/NorthwindEmployees/*[local-name='Employee' and namespace-uri()='urn:test1']
PS. Make sure you read "XML Namespaces and How They Affect XPath and
XSLT" at
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnexxml/html/xml05202002.asp
-- Oleg Tkachenko [XML MVP] http://blog.tkachenko.com
- Next message: Stephen: "Re: serialisation of classes to generate XMLDocument"
- Previous message: Oleg Tkachenko [MVP]: "Re: XPath: counting unique values"
- In reply to: Peter Theill: "XPath and default (overridden) namespaces"
- Next in thread: Peter Theill: "Re: XPath and default (overridden) namespaces"
- Reply: Peter Theill: "Re: XPath and default (overridden) namespaces"
- Reply: Oleg Tkachenko [MVP]: "Re: XPath and default (overridden) namespaces"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|