Hi;
I've just been through
http://www.w3.org/TR/xpath and
http://www.w3.org/TR/REC-xml-names/ and I can't find anything that requires a
prefix for the default namespace.
I did not find anything that specifically said it was ok to have no prefix
but this (from the doc) seemed to sort-of say it:
5.2 Element Nodes
There is an element node for every element in the document. An element node
has an expanded-name computed by expanding the QName of the element specified
in the tag in accordance with the XML Namespaces Recommendation [XML Names].
The namespace URI of the element's expanded-name will be null if the QName
has no prefix and there is no applicable default namespace.
Could you please point me at this requirement?
--
thanks - dave
"Kevin Yu [MSFT]" wrote:
Hi Dave,
This is by design in .NET that we have to specify the prefix for the node
in an XPath expression, even it is in the default namespace.
If you have an XPath expression with a qualified name e.g.
pf:element-name, then that prefix pf needs to be bound to a namespace URI,
otherwise the XPath expression can't be evaluated. Some tools automatically
provide a binding of prefixes to namespace URIs then fine, but the .NET API
requires you to define those binding yourself if you want to use XPath
expressions with qualified names.
As for elements in the default namespace it is certainly correct acording
to the specs that you can only select them with an XPath expression using a
prefix bound to that default namespace URI, if those tools return/select
nodes in a default namespace by using unqualified names without a prefix
then those tools do not implement XPath 1.0 as is specified.
Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."