470,833 Members | 1,387 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

Getting an IXPathNavigator's Document

I'm trying to do the functional equivalent of IsNodeDocument(IXPathNavigable
myNode, IXPathNavigable potentialRoot), but I can't seem to get any
comparisons that will work. If I use MoveToRoot(), I lose the state of
myNode, but SelectAncestors(XPathNodeType.Root, true/false) won't work on an
attribute.
Aug 20 '06 #1
5 1286
Keith Patrick wrote:
I'm trying to do the functional equivalent of IsNodeDocument(IXPathNavigable
myNode, IXPathNavigable potentialRoot), but I can't seem to get any
comparisons that will work.
If I use MoveToRoot(), I lose the state of
myNode,
You can always clone current node - that's the recommended way.

but SelectAncestors(XPathNodeType.Root, true/false) won't work on an
attribute.
SHould work I think. Select("/") will work anyway.
--
Oleg Tkachenko [XML MVP, MCPD]
http://blog.tkachenko.com | http://www.XmlLab.Net | http://www.XLinq.Net
Aug 20 '06 #2
That works, thanks. Do you happen to know if "/" is defined as a constant
somewhere in the BCL? I'ver searched some of the XPath namespace for one
but couldn't find one.

Aug 20 '06 #3
Keith Patrick wrote:
That works, thanks. Do you happen to know if "/" is defined as a constant
somewhere in the BCL? I'ver searched some of the XPath namespace for one
but couldn't find one.
/ is defined as root node in XPath. See
http://www.w3.org/TR/xpath#location-paths

--
Oleg Tkachenko [XML MVP, MCPD]
http://blog.tkachenko.com | http://www.XmlLab.Net | http://www.XLinq.Net
Aug 21 '06 #4
I mean in the sense that there's a declaration:
public const String RootNode = "/";
somewhere in the BCL (i.e. System.Xml.XPath.XPathExpression). FxCop will
generally flag magic strings, and I have a const already defined, but if
there's a BCL-defined constant for the root node, I'd rather use it.

Aug 21 '06 #5
Keith Patrick wrote:
I mean in the sense that there's a declaration:
public const String RootNode = "/";
somewhere in the BCL (i.e. System.Xml.XPath.XPathExpression). FxCop will
generally flag magic strings, and I have a const already defined, but if
there's a BCL-defined constant for the root node, I'd rather use it.
No, I don't think there is such constant. It's just XPath expression.

--
Oleg Tkachenko [XML MVP, MCPD]
http://blog.tkachenko.com | http://www.XmlLab.Net | http://www.XLinq.Net
Aug 22 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

15 posts views Thread by middletree | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.