예제 #1
0
 public XNodeNavigator(XNode node, XmlNameTable nameTable)
 {
     this.source    = node;
     this.nameTable = nameTable != null ? nameTable : CreateNameTable();
 }
예제 #2
0
 /// <summary>
 /// Select an <see cref="XElement"/> using a XPath expression
 /// </summary>
 /// <param name="node">Extension point <see cref="XNode"/></param>
 /// <param name="expression">The XPath expression</param>
 /// <param name="resolver">A <see cref="IXmlNamespaceResolver"/> for the namespace
 /// prefixes used in the XPath expression</param>
 /// <returns>An <see cref="XElement"> or null</see></returns>
 public static XElement XPathSelectElement(this XNode node, string expression, IXmlNamespaceResolver resolver)
 {
     return(node.XPathSelectElements(expression, resolver).FirstOrDefault());
 }
예제 #3
0
 /// <summary>
 /// Select a set of <see cref="XElement"/> using a XPath expression
 /// </summary>
 /// <param name="node">Extension point <see cref="XNode"/></param>
 /// <param name="expression">The XPath expression</param>
 /// <returns>An <see cref="IEnumerable&lt;XElement&gt;"/> corresponding to the resulting set of elements</returns>
 public static IEnumerable <XElement> XPathSelectElements(this XNode node, string expression)
 {
     return(node.XPathSelectElements(expression, null));
 }
예제 #4
0
 /// <summary>
 /// Evaluates an XPath expression
 /// </summary>
 /// <param name="node">Extension point <see cref="XNode"/></param>
 /// <param name="expression">The XPath expression</param>
 /// <returns>The result of evaluating the expression which can be typed as bool, double, string or
 /// IEnumerable</returns>
 public static object XPathEvaluate(this XNode node, string expression)
 {
     return(node.XPathEvaluate(expression, null));
 }
예제 #5
0
 /// <summary>
 /// Select an <see cref="XElement"/> using a XPath expression
 /// </summary>
 /// <param name="node">Extension point <see cref="XNode"/></param>
 /// <param name="expression">The XPath expression</param>
 /// <returns>An <see cref="XElement"> or null</see></returns>
 public static XElement XPathSelectElement(this XNode node, string expression)
 {
     return(node.XPathSelectElement(expression, null));
 }
예제 #6
0
 public static IXPathNavigable ToXPathNavigable(this XNode node)
 {
     return(new XDocumentNavigable(node));
 }
예제 #7
0
 /// <summary>
 /// Creates an <see cref="XPathNavigator"/> for a given <see cref="XNode"/>
 /// </summary>
 /// <param name="node">Extension point <see cref="XNode"/></param>
 /// <returns>An <see cref="XPathNavigator"/></returns>
 public static XPathNavigator CreateNavigator(this XNode node)
 {
     return(node.CreateNavigator(null));
 }
예제 #8
0
파일: Extensions.cs 프로젝트: raj581/Marvin
 public static IEnumerable <XElement> XPathSelectElements(this XNode node, string xpath)
 {
     return(XPathSelectElements(node, xpath, null));
 }
예제 #9
0
 public XDocumentNavigable(XNode n)
 {
     _node = n;
 }
예제 #10
0
파일: Extensions.cs 프로젝트: raj581/Marvin
 public static object XPathEvaluate(this XNode node, string expression, IXmlNamespaceResolver nsResolver)
 {
     return(CreateNavigator(node).Evaluate(expression, nsResolver));
 }
예제 #11
0
파일: Extensions.cs 프로젝트: raj581/Marvin
 public static XElement XPathSelectElement(this XNode node, string xpath)
 {
     return(XPathSelectElement(node, xpath, null));
 }
예제 #12
0
파일: Extensions.cs 프로젝트: raj581/Marvin
 public static XPathNavigator CreateNavigator(this XNode node, XmlNameTable nameTable)
 {
     return(new XNodeNavigator(node, nameTable));
 }
예제 #13
0
파일: Extensions.cs 프로젝트: raj581/Marvin
 public static XPathNavigator CreateNavigator(this XNode node)
 {
     return(CreateNavigator(node, new NameTable()));
 }
예제 #14
0
 public XNodeNavigator(XNode node, XmlNameTable?nameTable)
 {
     _source    = node;
     _nameTable = nameTable != null ? nameTable : CreateNameTable();
 }
예제 #15
0
        /// <summary>
        /// Select a set of <see cref="XElement"/> using a XPath expression
        /// </summary>
        /// <param name="node">Extension point <see cref="XNode"/></param>
        /// <param name="expression">The XPath expression</param>
        /// <param name="resolver">A <see cref="IXmlNamespaceResolver"/> for the namespace
        /// prefixes used in the XPath expression</param>
        /// <returns>An <see cref="IEnumerable&lt;XElement&gt;"/> corresponding to the resulting set of elements</returns>
        public static IEnumerable <XElement> XPathSelectElements(this XNode node, string expression, IXmlNamespaceResolver?resolver)
        {
            ArgumentNullException.ThrowIfNull(node);

            return((IEnumerable <XElement>)XPathEvaluator.Evaluate <XElement>(node, expression, resolver));
        }
예제 #16
0
        /// <summary>
        /// Evaluates an XPath expression
        /// </summary>
        /// <param name="node">Extension point <see cref="XNode"/></param>
        /// <param name="expression">The XPath expression</param>
        /// <param name="resolver">A <see cref="IXmlNamespaceResolver"> for the namespace
        /// prefixes used in the XPath expression</see></param>
        /// <returns>The result of evaluating the expression which can be typed as bool, double, string or
        /// IEnumerable</returns>
        public static object XPathEvaluate(this XNode node, string expression, IXmlNamespaceResolver?resolver)
        {
            ArgumentNullException.ThrowIfNull(node);

            return(XPathEvaluator.Evaluate <object>(node, expression, resolver));
        }