I have a whole XML document in a String which i need to convert to a XML document and parse tags in the document
Using Linq to xml
Add a reference to System.Xml.Linq
and use
XDocument.Parse(string xmlString)
Edit: Sample follows, xml data (TestConfig.xml)..
Convert number to string
Examp1.EXE
1
Find succeeding characters
Examp2.EXE
abc
Convert multiple numbers to strings
Examp2.EXE /Verbose
123
Find correlated key
Examp3.EXE
a1
Count characters
FinalExamp.EXE
This is a test
Another Test
Examp2.EXE
Test Input
C# usage...
XElement root = XElement.Load("TestConfig.xml");
IEnumerable tests =
from el in root.Elements("Test")
where (string)el.Element("CommandLine") == "Examp2.EXE"
select el;
foreach (XElement el in tests)
Console.WriteLine((string)el.Attribute("TestId"));
This code produces the following output: 0002 0006