/// <include file='doc\XmlNode.uex' path='docs/doc[@for="XmlNode.SelectSingleNode1"]/*' /> /// <devdoc> /// <para>Selects the first node that matches the xpath expression and given namespace context.</para> /// </devdoc> public XmlNode SelectSingleNode( string xpath, XmlNamespaceManager nsmgr ) { XPathNavigator xn = (this).CreateNavigator(); XPathExpression exp = xn.Compile(xpath); exp.SetContext(nsmgr); try { XmlNodeList list = new XPathNodeList( xn.Select(exp) );; return list[0]; } catch( ArgumentOutOfRangeException ) { return null; } }
// Selects the first node that matches the xpath expression and given namespace context. public XmlNode SelectSingleNode( string xpath, XmlNamespaceManager nsmgr ) { XPathNavigator xn = (this).CreateNavigator(); //if the method is called on node types like DocType, Entity, XmlDeclaration, //the navigator returned is null. So just return null from here for those node types. if( xn == null ) return null; XPathExpression exp = xn.Compile(xpath); exp.SetContext(nsmgr); XmlNodeList list = new XPathNodeList( xn.Select(exp) );; if( list.Count > 0 ) return list[0]; else return null; }
public XmlNodeListEnumerator(XPathNodeList list) { _list = list; _index = -1; _valid = false; }
public XmlNodeListEnumerator(XPathNodeList list) { this.list = list; this.index = -1; this.valid = false; }