PDA

Click to See Complete Forum and Search --> : Writing to an XML and converting my DOM to a string **very SOLVED**


Sgt-Peppa
Jul 21st, 2003, 09:40 AM
Hey ,

o my good, i am not able to get any of my code working today!
Ok heres what I am trying to do: I am importing a xml document into a dom. Then I want to select single node and add a value to it. Finally I want to convert the whole dom into a string! Heres my code:


string encodedData ="";
XmlDocument finalDoc = new XmlDocument();
string final = "";

byte[] encData_byte = new byte[data.Length];
encData_byte = System.Text.Encoding.Unicode.GetBytes(data);
encodedData = Convert.ToBase64String(encData_byte);
finalDoc.Load(@"D:\Projects\x400_Adapter\Solution\Outbound\header.xml");
string tmp = finalDoc.DocumentElement.Name;


XmlNode idnode = finalDoc.DocumentElement.SelectSingleNode("//InternalID");
idnode.InnerText.Insert(0,id); //this is not working

XmlNode bodynode = finalDoc.DocumentElement.SelectSingleNode("//Body");
bodynode.InnerText.Insert(0,encodedData); //this is not working

finalDoc.Save(@"D:\Projects\x400_Adapter\Solution\Outbound\test.xml");

final = finalDoc.ToString();
return final;


Please give me a hand on this one,

Thanx Stephan

Sgt-Peppa
Jul 21st, 2003, 10:04 AM
Ok stupid me!!!!!! Found out how to write my values:

But still dont know how to convert the whole dom into a string!

Sgt-Peppa
Jul 21st, 2003, 10:25 AM
Ok, ok nevermind, ignore that thread! I figured it out! God somtimes i am really codeblind! Just ignore this! Thanx anyways

Stephan