System.Xml.XPath.XPathNavigator.MoveToPrevious C# (CSharp) Method

MoveToPrevious() public abstract method

public abstract MoveToPrevious ( ) : bool
return bool
        public abstract bool MoveToPrevious();

Same methods

XPathNavigator::MoveToPrevious ( XPathNodeType type ) : bool
XPathNavigator::MoveToPrevious ( string localName, string namespaceURI ) : bool

Usage Example

		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");
			
		}
All Usage Examples Of System.Xml.XPath.XPathNavigator::MoveToPrevious