XPathExpression.AddSort not working with xmlns
Hi there,
don't know whether anyone ran into this issue formerly (in .NET 1.0).
I have an XML document with a default namespace (indicating the target namespace of the XML Schema used to validate the document):
<ObjectIndex xmlns="http://ref.devlink.net/opal/runtime/ObjectBaseSchema.xsd">
Adding the default namespace to an XmlNamespaceManager with a bogus prefix and prefixing element and attribute names in XPathExpressions is the only way that works to evaluate and search with XPathNavigator on documents that have such a default namespace applied, which is annoyingly enough.
What's more, trying to sort the selected nodes using the XPathExpression.AddSort method doesn't seem to work when a default namespace exists - simply NO nodes at all are returned!
Using the bogus namespace prefix within the sort key works, if (and only if) the namespace manager has been added to the XPathExpression twice (!) - before and after the .AddSort () statement. Moreover, although now the selected nodes are returned correctly, the desired sorting is simply NOT applied to the resultant node set!!
What am I missing here? Is this a framework bug? I don't want to remove the default namespace - I need it for validation and when selecting with XPath, I use the performant, but read-only XPathDocument rather than the DOM-Document...
Any help would be greatly appreciated.
Best, Philipp
|