I want to add an XML string as new node to an existing XML document.
For example, suppose the input from the user is:
<bk:book>
<title>Pride And Prejudice</title>
<authorlastname>Jane</authorlastname>
<authorfirstname>Austen</authorfirstname>
<price>24.95</price>
</bk:book>
I am trying to insert that user input as follows:
xml_SourceDoc.Root.LastNode.AddAfterSelf(XElement.Parse(xmlString));
However, that statement is raising this exception:
bk is an undeclared prefix. Line 1, position 2.
How can I change my approach so that I can successfully insert any text that is input by the user?