I have been supplied an xsd file.
This represents a message I must send a client.
My approach to build the message is as follows:
DataSet ds = new DataSet();
ds.ReadXmlScheme("myfile.xsd");
This give me a DataSet with a number of tables.
In the xsd document, there is a table called policy_details.
This table is made up of 6 elements, but one element actually relates to
another table (policy_premium):
This means the DataSet actually has a table called policy_details and
policy_premium.
I create a new row for policay_details, populate required fields, and do
the same for policy_premium:
tableName = "policy_premium";
dr = ds.Tables[tableName].NewRow();
dr["policy_premium_text"] = "1058.11";
dr["policy_details_id"] = "1";
ds.Tables[tableName].Rows.Add(dr);
At the end of this I do:
ds.WriteXML(_strWriter, XmlWriteMode.IgnoreSchema);
string strPost = _strWriter.ToString();
This creates the document I expected except the policy_premium is the
last field in the policy_details, but according to the xsd this field
should be the fourth. This means the message fails validation.
Can anyone explain how I can get the XML to render in the same order as
the xsd file, or have I taken the wrong approach to this problem?
Steven
*** Sent via Developersdex http://www.developersdex.com ***