469,592 Members | 1,928 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,592 developers. It's quick & easy.

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
Nov 15 '05 #1
0 1311

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by DN | last post: by
2 posts views Thread by Steve Taylor | last post: by
4 posts views Thread by gajba | last post: by
4 posts views Thread by viditmittal | last post: by
1 post views Thread by DN | last post: by
2 posts views Thread by darrel | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.