I have a dictionary that I'm serializing and I'm trying to add the root element to a new xml document.
New XML Document looks like this:
<?xml version="1.0" encoding="utf-8"?>
<WordList>
<IgnoredWords />
</WordList>
My xml file looks something like this:
<?xml version="1.0" encoding="utf-8"?>
<MisspelledWords xmlns:xsi="http://ift.tt/ra1lAU" xmlns:xsd="http://ift.tt/tphNwY">
<word>
<Suggestions/>
<Locations>
<Location>
<FileName/>
<LineNumber/>
<OriginalLine/>
</Location>
</Locations>
<word>
</MisspelledWords>
Here is what I'm trying to do in C#:
xmlWordListDoc.Save("wordlist.xml");
XmlTextReader xmlTextReader1 = new XmlTextReader("misspelledwords.xml");
XmlDocument xmlMisspelledWordsDoc = new XmlDocument();
xmlMisspelledWordsDoc.Load(xmlTextReader1);
xmlTextReader1.Close();
XmlNode misspelledWords = xmlMisspelledWordsDoc.SelectSingleNode("/MisspelledWords");
XmlTextReader xmlTextReader2 = new XmlTextReader("wordlist.xml");
XmlDocument wordlistDoc = new XmlDocument();
wordlistDoc.Load(xmlTextReader2);
xmlTextReader2.Close();
wordlistDoc.AppendChild(misspelledWords);
wordlistDoc.Save("wordlist.xml");
Thank you for any help you can give.
No comments:
Post a Comment