Formating the xml-output from a DataSet
-
Helo :~ I know that I have done this before, controling how the output-xml is formated. The default i:
<NewDataSet>
<table>
<col1>val</col1>
<col2>val</col2>
</table>
<table>
<col1>val</col1>
<col2>val</col2>
</table>
<NewDataSet>But I want it to be:
<NewDataSet>
<table col1="val" col2="val">
<table col1="val" col2="val">
</NewDataSet>What is the property to set ????
-
Helo :~ I know that I have done this before, controling how the output-xml is formated. The default i:
<NewDataSet>
<table>
<col1>val</col1>
<col2>val</col2>
</table>
<table>
<col1>val</col1>
<col2>val</col2>
</table>
<NewDataSet>But I want it to be:
<NewDataSet>
<table col1="val" col2="val">
<table col1="val" col2="val">
</NewDataSet>What is the property to set ????
Do you have a schema? You need one to achieve this. In VS, open the .xsd file,and click on DataSet tab at the bottom. You will see a table named
table
(as your example) and the columns with their types. You will see in the first column an E, change it to an A and there you go. If you don't have a schema, simply build by hand a XML file that will look like what you want. Open it with VS and choose, from the XML menu, Create Schema. In your program, before loading the DataSet with data from an XML file, or before saving to an XML file, use one of themyDataSet.ReadXmlSchema
methods. When reading, always use theXmlReadMode.Auto
and maybe set themyDataSet.EnforceConstraints
property totrue
to detect any schema errors. Have fun! -
Helo :~ I know that I have done this before, controling how the output-xml is formated. The default i:
<NewDataSet>
<table>
<col1>val</col1>
<col2>val</col2>
</table>
<table>
<col1>val</col1>
<col2>val</col2>
</table>
<NewDataSet>But I want it to be:
<NewDataSet>
<table col1="val" col2="val">
<table col1="val" col2="val">
</NewDataSet>What is the property to set ????
You can set the
ColumnMapping
property on each column toMappingType.Attribute
.Without nipples, breasts would be pointless.
-
You can set the
ColumnMapping
property on each column toMappingType.Attribute
.Without nipples, breasts would be pointless.