xml and dataset problem

xml Lebanon
  • 10 years ago

    Project is in asp.net web service version 2.0 language C#.

    I have an xsd schema consisting of 6 elements, 1 element inside another one.

    example of xml file: <a> <a1><a2 id=23 name =""/> </a1></a>

                                   <b><b1><b2 id="" name=""/></b1></b>

    And I want to create an xml file by that schema.

    So I'm creating a dataset and reading the schema. Then I'm modifying some rows in some tables. And then i'm returning the xml from the dataset. The problem is that  when i'm doing dset.getXML() , it's returning only the tags that have the attributes. such as:

    <xml><a2 id=23 name =""/><b2 id="" name=""/> </xml>

     So how do i fix it so i display the full xml structure from the dataset?

    The code is the following:

     DataSet dset = new DataSet();

     //add data for table "a2"
     dset.Tables[2].Rows.Add(new object[] { "10", "europe" });

     //add data for table "b2"
    dset.Tables[5].Rows.Add(new object[] { "1", "march"});

    return dset.GetXml();



Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“It works on my machine.” - Anonymous