Reputation: 295
I am trying to parse the below with in C# with xmldocument. but I can't load it. It says invalid characters. Even in the browser it doesn't display correctly complaining about invalid characters. I need to loop through all elements in this string. Can someone please advise what's wrong here?
<div><b>Q1.
What is your name?:</b> BTB (Build the bank)</div>
<div><b>Q2.
How old are you?:</b> 29</div>
code is this:
XmlDocument xml = new XmlDocument();
xml.Load(item.Summary);
error is: "Illegal characters in path."
Upvotes: 0
Views: 458
Reputation: 3907
"BTB (Build the bank)" needs to be wrapped in its own tag if this shall be a valid xml. It is valid html though. Also, xml must have a single top node.
Upvotes: 1
Reputation: 14157
XmlDocument.Load expects a file name to load the xml from. Try LoadXml.
Upvotes: 2