public XNodeNavigator(XNode node, XmlNameTable nameTable) { this.source = node; this.nameTable = nameTable != null ? nameTable : CreateNameTable(); }
/// <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()); }
/// <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<XElement>"/> corresponding to the resulting set of elements</returns> public static IEnumerable <XElement> XPathSelectElements(this XNode node, string expression) { return(node.XPathSelectElements(expression, null)); }
/// <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)); }
/// <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)); }
public static IXPathNavigable ToXPathNavigable(this XNode node) { return(new XDocumentNavigable(node)); }
/// <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)); }
public static IEnumerable <XElement> XPathSelectElements(this XNode node, string xpath) { return(XPathSelectElements(node, xpath, null)); }
public XDocumentNavigable(XNode n) { _node = n; }
public static object XPathEvaluate(this XNode node, string expression, IXmlNamespaceResolver nsResolver) { return(CreateNavigator(node).Evaluate(expression, nsResolver)); }
public static XElement XPathSelectElement(this XNode node, string xpath) { return(XPathSelectElement(node, xpath, null)); }
public static XPathNavigator CreateNavigator(this XNode node, XmlNameTable nameTable) { return(new XNodeNavigator(node, nameTable)); }
public static XPathNavigator CreateNavigator(this XNode node) { return(CreateNavigator(node, new NameTable())); }
public XNodeNavigator(XNode node, XmlNameTable?nameTable) { _source = node; _nameTable = nameTable != null ? nameTable : CreateNameTable(); }
/// <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<XElement>"/> 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)); }
/// <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)); }