Customizing XML from DataSet

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • John Knoop

    #1

    Customizing XML from DataSet

    Hi all!

    I have a dataset filled containing one row of data. Dataset.WriteXM L gives
    me this:

    <Article>
    <Table>
    <aID>10</aID>
    <aHeader>Some text goes here</aHeader>
    <aDate>2003-07-04T12:06:00.000 0000+02:00</aDate>
    <authorID>1</authorID>
    <pID>2</pID>
    <authorID1>1</authorID1>
    <pID1>2</pID1>
    </Table>
    </Article>

    But I would rather have it like this:

    <Article>
    - <Table>
    <aHeader>Some text goes here</aHeader>
    <aDate>2003-07-04T12:06:00.000 0000+02:00</aDate>
    <authorID>1</authorID>
    </Table>
    </Article>

    Dataset.WhiteXm lSchema gives me this:

    <?xml version="1.0" ?>
    - <xs:schema id="NewDataSet " xmlns=""
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:msdata="u rn:schemas-microsoft-com:xml-msdata">
    - <xs:element name="NewDataSe t" msdata:IsDataSe t="true"
    msdata:Locale=" sv-SE">
    - <xs:complexType >
    - <xs:choice maxOccurs="unbo unded">
    - <xs:element name="Table">
    - <xs:complexType >
    - <xs:sequence>
    <xs:element name="aID" type="xs:int" minOccurs="0" />
    <xs:element name="aHeader" type="xs:string " minOccurs="0" />
    <xs:element name="aDate" type="xs:dateTi me" minOccurs="0" />
    <xs:element name="authorID" type="xs:int" minOccurs="0" />
    <xs:element name="pID" type="xs:int" minOccurs="0" />
    <xs:element name="authorID1 " type="xs:int" minOccurs="0" />
    <xs:element name="pID1" type="xs:int" minOccurs="0" />
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    </xs:choice>
    </xs:complexType>
    </xs:element>
    </xs:schema>

    But I suppose I'd rather want it like this:

    <?xml version="1.0" ?>
    - <xs:schema id="NewDataSet " xmlns=""
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:msdata="u rn:schemas-microsoft-com:xml-msdata">
    - <xs:element name="NewDataSe t" msdata:IsDataSe t="true"
    msdata:Locale=" sv-SE">
    - <xs:complexType >
    - <xs:choice maxOccurs="unbo unded">
    - <xs:element name="Table">
    - <xs:complexType >
    - <xs:sequence>
    <xs:element name="aHeader" type="xs:string " minOccurs="0" />
    <xs:element name="aDate" type="xs:dateTi me" minOccurs="0" />
    <xs:element name="authorID" type="xs:int" minOccurs="0" />
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    </xs:choice>
    </xs:complexType>
    </xs:element>
    </xs:schema>

    Can anybody help me? Is there any way to force the dataset into the shape of
    a user-specified schema? Or would that be the wrong approach.

    /john


Working...