Find the index of an xml element in text C# -
I am creating a WPF app that displays XML in the flow document, and the user has the element or element in this XML XPath can choose. I want to be able to highlight the value of the element that is opting in XPath Flo document. I am currently highlighting the use. The problem is that when the flow document displays a string, then I need to find the pointer to any element (sipad) that xpath shows in this string - i can not simply search it as text because it Can I Produce False Matches Any Suggestion How Can I Do It?
If you are happy to use LINQ instead of XML (this is a generally good API) And if you know the position of the line within the line and the situation is enough in the line, then you can use it:
using the system; Using System.Xml; Using System.Xml.Linq; Using System.Xml.XPath; Class Program {Static Wide Men (String [] AGRs) {var xml = XDocument.Load ("test.xml", Loadedoptions.SetLineInfo); Var xpath = "/ root / child"; Var result = xml.XPathSelectElements (xpath); Leading (various elements as a result) {var info = (IXmlLineInfo) element; Console.light line ("{0}: {1} {2}", information. Linum, information. Linepoint, element); }}} It is entirely possible that you can also use it with XmlElement , but I'm not sure how. It does not give you the status of the character, of course - but on some side, you can easily work out the character space of the beginning of each line appropriate to specify the fixed character position Something else can happen, of course - I have not seen it.
Comments
Post a Comment