using System.Xml; using System.Xml.Linq; using System.Xml.XPath; namespace CRIF.ACTion.Common.Parsers { public static class XElementExtensions { /* Using XPathSelectElement on an XElement starts with the XElement's parent XDocument, unless you convert the XElement itself to an XDocument */ public static XElement XElementXPathSelectElement(this XElement node, string expression) { return (new XDocument(node)).XPathSelectElement(expression); } public static XElement XElementXPathSelectElement(this XNode node, string expression, IXmlNamespaceResolver resolver) { return (new XDocument(node)).XPathSelectElement(expression, resolver); } public static IEnumerable XElementXPathSelectElements(this XElement node, string expression) { return (new XDocument(node)).XPathSelectElements(expression); } public static IEnumerable XElementXPathSelectElements(this XElement node, string expression, IXmlNamespaceResolver resolver) { return (new XDocument(node)).XPathSelectElements(expression, resolver); } } }