C# XElement to Xpath and vice versa [duplicate]




This question already has an answer here:




Is there a way I can convert an XElement to an XPath? This is my XElement:



XElement xElement = new XElement("ObjectType", new XAttribute("type", My.Class.Path.Foo));


according to here: http://ift.tt/15mP1Hr


I should be using this Xpath expression to match the XElement:



ObjectType[@type="My.Class.Path.Foo"]


navigator contains the XElement, match returns false.



match = navigator.Select('xpath expression here').Count > 0;

No comments:

Post a Comment