Results 1 to 7 of 7

Thread: C# to XML **SOLVED**

  1. #1

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

    C# to XML **SOLVED**

    Hey,
    is there any way I can jump to the root node of my xml document?

    eg:

    XmlNode mynode = mydoc.getRootNode

    Thanx in advance,


    Stephan
    Last edited by Sgt-Peppa; Jun 11th, 2003 at 06:43 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

  2. #2
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Try populating a dataset from your XML File , then the first table is the root of that file .

  3. #3

    Thread Starter
    Hyperactive Member Sgt-Peppa's Avatar
    Join Date
    Mar 2003
    Location
    Munich - Germany
    Posts
    476
    First of all thanx for your help, but never had to work with a dataset up till now.Do you have an example?

    Thanx,
    Stephan
    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

  4. #4
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Sure ,

    This is very simple example to work with Dataset . It loads columns of XML File into a combobox .

  5. #5
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    I almost forgot the attatchment .

    BTW , it's C#.NET 2003 . You may need to convert it with the tool under my sig .
    Attached Files Attached Files

  6. #6

    Thread Starter
    Hyperactive Member Sgt-Peppa's Avatar
    Join Date
    Mar 2003
    Location
    Munich - Germany
    Posts
    476
    WOW, this is Cool,

    Thanx for that piece of code! No need to convert, I am on 2003 too. Thats pretty need to play around with. Even thogh I just found found another alternative.

    It was right in front of my eyes and I just couldnt see it.

    Heres what I did:

    Code:
    		XmlDocument compare = new XmlDocument(); //new Instance of xml-Document
    		compare.Load(path);  // select the xml source
    		XmlNode mynode = compare.DocumentElement; // new Instance of Node
    So mynode is now my rootnode! God I am so "codeblind" today!

    But thanx anyways, cause your example is sth I can use too!

    Hope you have a better "coding day" than I have.

    CU,
    Stephan
    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

  7. #7
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    You need off days .

    Glad you got it working .

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