public static System.Xml.XPath.XPathNodeIterator GetNodeIt(System.Xml.XPath.XPathNavigator xnav, string xPath, System.Xml.XmlNamespaceManager nsmgr) { System.Xml.XPath.XPathExpression xpathExpr = xnav.Compile(xPath); if (nsmgr != null) { xpathExpr.SetContext(nsmgr); } return(xnav.Select(xpathExpr)); }
private bool CanCompileXpathExpression(string xpath) { bool result = false; try { System.Xml.XPath.XPathExpression oXPathExpression = System.Xml.XPath.XPathExpression.Compile(txtXPath.Text); result = true; } catch { result = false; } return(result); }
/// <summary> /// Setup Message Content Query for filtering messages /// </summary> /// <param name="pContext"></param> /// <param name="pInMsg"></param> private void SetupMessageContentQuery(IPipelineContext pContext, ref IBaseMessage pInMsg) { //make sure the stream is seekable, otherwise, wrap it in seekable stream System.IO.Stream streamWrapper = pInMsg.BodyPart.GetOriginalDataStream(); if (!pInMsg.BodyPart.GetOriginalDataStream().CanSeek) { streamWrapper = new ReadOnlySeekableStream(pInMsg.BodyPart.GetOriginalDataStream()); pInMsg.BodyPart.Data = streamWrapper; pContext.ResourceTracker.AddResource(streamWrapper); } //clone the stream to prevent XPathNavigator closing the stream System.IO.Stream streamClone = new System.IO.MemoryStream(Encoding.UTF8.GetBytes(new System.IO.StreamReader(streamWrapper).ReadToEnd())); streamClone.Seek(0, System.IO.SeekOrigin.Begin); System.Xml.XPath.XPathNavigator navigator = new System.Xml.XPath.XPathDocument(streamClone).CreateNavigator(); //perform the queries System.Xml.XPath.XPathExpression query = null; if (!string.IsNullOrEmpty(XPathQuery1)) { query = navigator.Compile(XPathQuery1); isQuery1FoundAndMatch = Convert.ToBoolean(navigator.Evaluate(query)); } if (!string.IsNullOrEmpty(XPathQuery2)) { query = navigator.Compile(XPathQuery2); isQuery2FoundAndMatch = Convert.ToBoolean(navigator.Evaluate(query)); } if (!string.IsNullOrEmpty(XPathQuery3)) { query = navigator.Compile(XPathQuery3); isQuery3FoundAndMatch = Convert.ToBoolean(navigator.Evaluate(query)); } if (!string.IsNullOrEmpty(XPathQuery4)) { query = navigator.Compile(XPathQuery4); isQuery4FoundAndMatch = Convert.ToBoolean(navigator.Evaluate(query)); } if (!string.IsNullOrEmpty(XPathQuery5)) { query = navigator.Compile(XPathQuery5); isQuery5FoundAndMatch = Convert.ToBoolean(navigator.Evaluate(query)); } streamWrapper.Seek(0, System.IO.SeekOrigin.Begin); pContext.ResourceTracker.AddResource(streamWrapper); }
public static System.Xml.XPath.XPathNodeIterator GetSortedNodeIt(System.Xml.XPath.XPathNavigator xnav, string xPath, System.Xml.XmlNamespaceManager nsmgr, string sortXpath, bool isAscending, bool isCaseSensitive, bool isNumber) { System.Xml.XPath.XPathExpression xpathExpr = xnav.Compile(xPath); System.Xml.XPath.XmlSortOrder sortOrder; System.Xml.XPath.XmlCaseOrder caseOrder; System.Xml.XPath.XmlDataType datatype; if (isAscending) { sortOrder = System.Xml.XPath.XmlSortOrder.Ascending; } else { sortOrder = System.Xml.XPath.XmlSortOrder.Descending; } if (isCaseSensitive) { caseOrder = System.Xml.XPath.XmlCaseOrder.UpperFirst; } else { caseOrder = System.Xml.XPath.XmlCaseOrder.None; } if (isNumber) { datatype = System.Xml.XPath.XmlDataType.Number; } else { datatype = System.Xml.XPath.XmlDataType.Text; } xpathExpr.AddSort(sortXpath, sortOrder, caseOrder, "", datatype); if (nsmgr != null) { xpathExpr.SetContext(nsmgr); } return(xnav.Select(xpathExpr)); }
public virtual bool Matches(System.Xml.XPath.XPathExpression expr) { return(default(bool)); }
public virtual object Evaluate(System.Xml.XPath.XPathExpression expr, System.Xml.XPath.XPathNodeIterator context) { return(default(object)); }
public virtual object Evaluate(System.Xml.XPath.XPathExpression expr) { return(default(object)); }
public virtual System.Xml.XPath.XPathNavigator SelectSingleNode(System.Xml.XPath.XPathExpression expression) { throw null; }
public virtual System.Xml.XPath.XPathNodeIterator Select(System.Xml.XPath.XPathExpression expr) { throw null; }
public virtual bool Matches(System.Xml.XPath.XPathExpression expr) { throw null; }
public virtual object Evaluate(System.Xml.XPath.XPathExpression expr) { throw null; }
public override IEnumerable <IPublishedContent> GetByXPath(bool preview, System.Xml.XPath.XPathExpression xpath, XPathVariable[] vars) => throw new NotImplementedException();
public IEnumerable <IPublishedContent> GetByXPath(UmbracoContext umbracoContext, bool preview, System.Xml.XPath.XPathExpression xpath, Core.Xml.XPathVariable[] vars) { throw new NotImplementedException(); }
public override IPublishedContent GetSingleByXPath(bool preview, System.Xml.XPath.XPathExpression xpath, Core.Xml.XPathVariable[] vars) { throw new NotImplementedException(); }
public virtual System.Xml.XPath.XPathNodeIterator Select(System.Xml.XPath.XPathExpression expr) { return(default(System.Xml.XPath.XPathNodeIterator)); }
public virtual System.Xml.XPath.XPathNavigator SelectSingleNode(System.Xml.XPath.XPathExpression expression) { return(default(System.Xml.XPath.XPathNavigator)); }
public virtual object Evaluate(System.Xml.XPath.XPathExpression expr, System.Xml.XPath.XPathNodeIterator context) { throw null; }