<?xml version="1.0"?><CDF> <UTILITYTYPE CODE="1"> <D2> <INSTPARAM CODE="P1-2-1-1-0" VALUE="242.72" UNIT="V" /> <INSTPARAM CODE="P1-2-2-1-0" VALUE="245.23" UNIT="V" /> <INSTPARAM CODE="P1-2-3-1-0" VALUE="243.08" UNIT="V" /> <INSTPARAM CODE="P2-1-1-1-0" VALUE="0" UNIT="A" /> <INSTPARAM CODE="P2-1-2-1-0" VALUE="0" UNIT="A" /> <INSTPARAM CODE="P2-1-3-1-0" VALUE="0" UNIT="A" /> <INSTPARAM CODE="P8-1-0-0-0" VALUE="RYB" /> <INSTPARAM CODE="P8-2-0-0-0" VALUE="" /> <INSTPARAM CODE="P3-2-1-1-0" VALUE="0" UNIT="k" /> <INSTPARAM CODE="P3-3-1-1-0" VALUE="0" UNIT="k" /><INSTPARAM CODE="P4-1-1-0-0" VALUE="" /><INSTPARAM CODE="P3-2-2-1-0" VALUE="0" UNIT="k" /><INSTPARAM CODE="P3-3-2-1-0" VALUE="0" UNIT="k" /><INSTPARAM CODE="P4-2-1-0-0" VALUE="" /><INSTPARAM CODE="P3-2-3-1-0" VALUE="0" UNIT="k" /><INSTPARAM CODE="P3-3-3-1-0" VALUE="0" UNIT="k" /><INSTPARAM CODE="P4-3-1-0-0" VALUE="" /><INSTPARAM CODE="P3-2-4-1-0" VALUE="0" UNIT="k" /><INSTPARAM CODE="P3-3-4-1-0" VALUE="0" UNIT="k" /><INSTPARAM CODE="P3-4-4-1-0" VALUE="0" UNIT="k" /><INSTPARAM CODE="P4-4-1-0-0" VALUE="" /><INSTPARAM CODE="P9-1-0-0-0" VALUE="50.02" UNIT="Hz" /> </D2> </UTILITYTYPE> </CDF>
P1-2-1-1-0 P1-2-2-1-0 P1-2-3-1-0 P2-1-1-1-0 P2-1-2-1-0 P2-1-3-1-0 P8-1-0-0-0 P8-2-0-0-0 P3-2-1-1-0 P3-3-1-1-0 ... ... ...
var xml = File.ReadAllText("data.xml"); var codes = Regex.Matches(xml, @"P\d-\d-\d-\d-\d"); foreach (var code in codes) { Console.WriteLine(code); }
XDocument xdoc = XDocument.Parse(_xml_text_here_); //or use Load method List<string> all = xdoc.Descendants("INSTPARAM") .Select(x=>x.Attribute("CODE").Value) .ToList(); foreach(string s in all) Console.WriteLine($"{s}");
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)