-
-
Notifications
You must be signed in to change notification settings - Fork 15
Description
I have an XML document like this that has a default namespace with no prefix:
<wells xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/terms/" version="1.4.1.1" xmlns="http://www.witsml.org/schemas/1series">
<well uid="w-255312">
<name>25/1-9</name>
<timeZone>+00:00</timeZone>
<commonData>
<dTimCreation>2019-11-29T16:44:05.3733225+00:00</dTimCreation>
<dTimLastChange>2019-11-29T16:44:05.3733225+00:00</dTimLastChange>
</commonData>
</well>
</wells>I would like to be able to do a query like this:
/wells/well
However, I get no results when I use XPath2SelectElements with this, regardless of whether I give it an XmlNamespaceManager with the default namespace working.
I know this was not supported in XPath 1.0, but I think my reading of the XPath 2.0 specification says it should be supported in XPath 2.0:
A QName in a name test is resolved into an expanded QName using the statically known namespaces in the expression context. It is a static error [err:XPST0081] if the QName has a prefix that does not correspond to any statically known namespace. An unprefixed QName, when used as a name test on an axis whose principal node kind is element, has the namespace URI of the default element/type namespace in the expression context; otherwise, it has no namespace URI.
I can see that in XPath.y, when processing a name test, the empty string is passed instead of context.NamespaceManager.DefaultNamespace when parsing the QName:
NameTest
: QName
{
XmlQualifiedName qualifiedName = QNameParser.Parse((String)$1,
context.NamespaceManager, "", context.NameTable);
$$ = XmlQualifiedNameTest.New(qualifiedName.Name, qualifiedName.Namespace);
}
| Wildcard
;
Am I misunderstanding something or is this a bug?