![]() |
![]() | ![]() | ![]() | Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Re: setProperty, selectionNamespaces, defaultNamespace [Thread Next] Re: setProperty, selectionNamespaces, defaultNamespaceTo: NULL Date: 11/2/2006 3:36:00 PM Alexander Schneider wrote: >> XPath 1.0 does not know anything like a default namespace thus the XPath >> expression //element always selects elements with the local name >> |element| in _no_ namespace. > > I use a workaround and add for the default namespace the prefix "default". > Now my "selection Namespace" property was set to > xmlns:default="http://www.w3.org/2001/XMLSchema" > > but I can't select something like "//element" but "//default:element" works > fine. That is not a work around but required by the way XPath 1.0 works. As I said already, in XPath 1.0 //element always selects elements in no namespace. XPath 1.0 does not know any default namespace declaration. If you want to select elements in a namespace (whether it is defined as a default namespace or not does not matter in terms of XPath) with an XPath 1.0 expression then you need to use e.g. //prefix:element where it depends on your XPath API how to bind that prefix to a namespace URI. So I suggested to choose a prefix and you have done so with "default" I think, now you can use XPath expressions like //default:element and that is the only way to select elements in a namespace with XPath 1.0. -- Martin Honnen --- MVP XML http://JavaScript.FAQTs.com/ | ![]() | ![]() | ![]() |
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | |||||
|
