Results 1 to 3 of 3

Thread: Writing to an XML and converting my DOM to a string **very SOLVED**

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member Sgt-Peppa's Avatar
    Join Date
    Mar 2003
    Location
    Munich - Germany
    Posts
    476

    Angry Writing to an XML and converting my DOM to a string **very SOLVED**

    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:

    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
    Last edited by Sgt-Peppa; Jul 21st, 2003 at 10:25 AM.
    Keep Smiling - even if its hard
    Frankie Says Relax, wossname Says Yeah!
    wossname:--Currently I'm wearing a gimp suit and a parachute.
    C# - Base64 Blog

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width