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
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