I'm hugely stuck and I have no idea why. I am reading in an XML file, and I just want to get the text from it. I've read a bunch of forums answers but none seem to quite do it.
What I am doing is reading an SVG XML file and then injecting it into HTML. I can load the XML into an XMLDoc, but can't figure out for the life of me two things.
First, I have no idea how to iterate the document. My expectation was that iterating the nodes recursively would actually yield values:
foreach (var node in xmlDoc.ChildNodes)
{
foreach (Attribute a in node.Attributes)
{
}
}
But the node and a lists have no properties (though there is a count). So that seemed busted. This would really be the best model, but I need to compare values and make edits.
I also tried just reading the doc into a string, but a whole bunch of carriage returns and stuff get in there (\n \r) and they just won't get removed. i.e.
finalResult = finalResult.Replace(@"\n", "");
And yet the \n are still there? I read where this appeared to just be a debugger issue, and it may be. I tried to write script to show the markup but I cannot seem to get it in a format suitable for debugging the HTM itself. I've also tried
Windows.Data.Html.
HtmlUtilities.ConvertToText(finalResult);
But that reduces it entirely to text as does:
System.Net.WebUtility.HtmlDecode(myEncodedString);
Any help is super appreciated. To recap, I want to be able to merge XML into HTML and then be able to debug the result.