I know, that there are a lot of question about parsing C#, but I couldn't find answer. So, I need to write a DLL for parsing XML, but with some features, as I don't know what elements are in XML file. I need to parse all nodes of file and their elements. How can I do it? Now, I'm working with simple file
<reg>
<email_login>[email protected]</email_login>
<email_password>nDOUn3TybD</email_password>
</reg>
and my dll code now is
public XmlNodeList GetElementsName(string path)
{
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(path);
XmlNodeList nodeList = xmlDoc.GetElementsByTagName("email_login");
return nodeList;
}
It should return "[email protected]". My console app:
XMLWorker worker = new XMLWorker();
string path = "file:///D:/temp/test.xml";
XmlNodeList nodeList = worker.GetElementsName(path);
for (int i = 0; i < nodeList.Count; i++)
Console.WriteLine(nodeList[i].InnerText);
Console.ReadLine();
But it returns "[email protected]"
How can I parse differently?
[email protected]by itself