output table.field in dataset.writexml function
Right now I have a function that calls a stored procedure that has 3 sql statements that return data in each into a dataset. I then output the data to a xml file. Is it possible for in the xml output file the node name be table.field instead of just field?
Example:
Code:
Dim connection As New SqlConnection(GetConnectionString())
Dim sdaBO As New SqlDataAdapter("sp_Order", connection)
sdaBO.SelectCommand.CommandType = CommandType.StoredProcedure
sdaBO.SelectCommand.Parameters.Add(New SqlParameter("@ORDERNUM", SqlDbType.Int, 4)).Value = txtBO_OrderNum.Text
Dim ds As New DataSet()
connection.Open()
sdaBO.Fill(ds)
ds.DataSetName = "dsData"
ds.Tables(0).TableName = "Customer"
ds.Tables(1).TableName = "OrderInfo1"
ds.Tables(2).TableName = "OrderInfo2"
Dim xmlDoc As StreamWriter = New StreamWriter(sFullXmlReportPath, False)
ds.WriteXml(xmlDoc, XmlWriteMode.WriteSchema)
xmlDoc.Close()
The above works great. The output schema would be similar to:
HTML Code:
<xs:element name="OrderNum" type="xs:int" minOccurs="0" />
<xs:element name="CustNum" type="xs:int" minOccurs="0" />
<xs:element name="Company" type="xs:string" minOccurs="0" />
One corresponding data row would show up as so:
HTML Code:
<OrderNum>1928</OrderNum>
<CustNum>1350</CustNum>
<Company>XX</Company>
But I would like it to be like so:
HTML Code:
<xs:element name="Order.OrderNum" type="xs:int" minOccurs="0" />
<xs:element name="Customer.CustNum" type="xs:int" minOccurs="0" />
<xs:element name="Customer.Company" type="xs:string" minOccurs="0" />
One corresponding data row would show up as so:
HTML Code:
<Order.OrderNum>1928</Order.OrderNum>
<Customer.CustNum>1350</Customer.CustNum>
<Customer.Company>XX</Customer.Company>
Thanks for any advice.