The problem occurs due to the fact that InnerXml
takes in raw XML and not textual information, thus when a string with the contents of "
within it is supplied, the XML reader decodes the data back to quotation marks which may cause a failure of the parsing process unless they are enclosed as an attribute or CDATA. To correct this, do not use InnerXml
when you simply want to add text, use InnerText
or InnerXml = “<|human|>
To fix this, do not use InnerXml
when you actually need to add the raw characters, save it using InnerText
or InnerXml =<|human|>
To correct, do not use InnerXml
when what you need is to add the text only, use InnerText
or InnerXml
= In short InnerXml
takes well formed XML whereas InnerText
takes literal strings, and therefore when you switch to InnerText
, the quotes will not be misunderstood and your XML will remain valid.