static void Main(string[] args) { var stream = new MemoryStream(); var element = XElement.Parse(@"<root><group id=""0"" combiner=""or""><filter id=""1"" /><filter id=""2"" /></group></root>"); //var element = XElement.Parse("<a>i<b id='1' o='2' p=''/><b id='2'><c /></b><b id='3' /><b id='4' o='u'>2</b></a>"); var buffer = XmlPathSegmenter.StringBuffer(element); var store = element.PathSegments(); foreach (var path in store.Keys.OrderBy(p => p)) { try { var s = store[path]; var t = buffer.Substring((int)s.Index, (int)s.Length); Console.WriteLine("> {2,-30} {0,-20} {1}", s, t, path); } catch { } } }
public PathIndexedXElement(XElement element) { buffer = XmlPathSegmenter.StringBuffer(element); store = element.PathSegments(); }