private MoveToPrevious ( XPathNodeType type ) : bool | ||
type | XPathNodeType | |
return | bool |
internal bool MoveToPrevious(XPathNodeType type)
{
XPathNavigator navClone = Clone();
int mask = GetContentKindMask(type);
while (MoveToPrevious())
{
if (((1 << (int)NodeType) & mask) != 0)
return true;
}
MoveTo(navClone);
return false;
}
XPathNavigator::MoveToPrevious ( ) : bool | |
XPathNavigator::MoveToPrevious ( string localName, string namespaceURI ) : bool |
public static string GetXPath (XPathNavigator n) { switch (n.NodeType) { case XPathNodeType.Root: return "/"; case XPathNodeType.Attribute: { string ret = "@" + n.Name; n.MoveToParent (); string s = GetXPath (n); return s + (s == "/" ? "" : "/") + ret; } case XPathNodeType.Element: { string ret = n.Name; int i = 1; while (n.MoveToPrevious ()) { if (n.NodeType == XPathNodeType.Element && n.Name == ret) i++; } ret += "[" + i + "]"; if (n.MoveToParent ()) { string s = GetXPath (n); return s + (s == "/" ? "" : "/") + ret; } } break; } throw new Exception ("node type not supported for editing"); }