xml and dataset problem

xml Lebanon
  • 13 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();
    dset.ReadXmlSchema(Server.MapPath("test.xsd"));

     //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).

Contribute

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.

“I invented the term Object-Oriented, and I can tell you I did not have C++ in mind.” - Alan Kay