P
Paul Eden
Hi all
Was wondering if you could shed any light on this:
Process - Load XSD into data set; Load data into tables; Write data out
in XML
Will paste in the XSD as the end of my post.
The schema loads in fine and data gets loaded fine too. The trouble is,
even though the schema creates the nesseccary tables ~and~ relations
~and~ sets the relations nested property to True, the XML output is
~not~ nested.
I load data into the customer table, then the address table (data is
being read in from a flat file) and write out using
CustomerData.WriteXml(CustomerFile)
Any suggestions?
Many thanks
Paul
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSPY v2004 rel. 4 U (http://www.xmlspy.com) by Paul
Eden (Paradise Solutions) -->
<xs:schema elementFormDefault="qualified"
attributeFormDefault="unqualified"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Customers">
<xs:annotation>
<xs:documentation>Customer collection</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="Customer" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="CustomerID" type="xs:ID"/>
<xs:element name="CustomerCode">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="10"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="AddressCount" type="xs:int"/>
<xs:element name="Address" maxOccurs="unbounded">
<xs:complexType>
<xs:complexContent>
<xs:extension base="refAddress"/>
</xs:complexContent>
</xs:complexType>
</xs:element>
<xs:element name="CurrencyCode" type="xs:string" default="1"/>
<xs:element name="Balance" type="refBalance" default="0.00"/>
<xs:element name="CurrentBalance" type="refBalance" default="0.00"/>
<xs:element name="Balance1" type="refBalance" default="0.00"/>
<xs:element name="Balance2" type="refBalance" default="0.00"/>
<xs:element name="Balance3" type="refBalance" default="0.00"/>
<xs:element name="Balance4" type="refBalance" default="0.00"/>
<xs:element name="Balance5" type="refBalance" default="0.00"/>
<xs:element name="Balance6" type="refBalance" default="0.00"/>
<xs:element name="CreditLimit" type="refBalance" default="0.00"/>
<xs:element name="Hold">
<xs:simpleType>
<xs:restriction base="xs:string"/>
</xs:simpleType>
</xs:element>
<xs:element name="DefaultPriceStream" type="xs:int" default="1"/>
<xs:element name="UsrField1" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="50"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="UsrField2" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="50"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="CompanyID" type="xs:int" default="1"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:simpleType name="refPstnNumber">
<xs:annotation>
<xs:documentation>Simple type for telephone/fax</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:whiteSpace value="preserve"/>
<xsattern value="[+0-9 ]{11,16}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="refBalance">
<xs:annotation>
<xs:documentation>Simple type for account balances</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:float">
<xs:minInclusive value="0.00"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="refAddress">
<xs:annotation>
<xs:documentation>Complex Type for Addresses</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element name="AddressID" type="xs:ID"/>
<xs:element name="CustomerID" type="xs:ID"/>
<xs:element name="AddressName">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="40"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Number" type="xs:int"/>
<xs:element name="Addr1">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="40"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Addr2">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="40"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Town">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="40"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="County">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="40"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Postcode">
<xs:simpleType>
<xs:restriction base="xs:string">
<xsattern value="[A-Za-z]{1,2}[1-9][0-9]?[A-Za-z]?
[0-9][A-Za-z]{2}|GIR 0AA|NONUK"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Country" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="40"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="ContactName" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="40"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Telephone" type="refPstnNumber" minOccurs="0"/>
<xs:element name="Fax" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string"/>
</xs:simpleType>
</xs:element>
<xs:element name="Email" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="255"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="RepCode" type="xs:integer"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
Was wondering if you could shed any light on this:
Process - Load XSD into data set; Load data into tables; Write data out
in XML
Will paste in the XSD as the end of my post.
The schema loads in fine and data gets loaded fine too. The trouble is,
even though the schema creates the nesseccary tables ~and~ relations
~and~ sets the relations nested property to True, the XML output is
~not~ nested.
I load data into the customer table, then the address table (data is
being read in from a flat file) and write out using
CustomerData.WriteXml(CustomerFile)
Any suggestions?
Many thanks
Paul
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSPY v2004 rel. 4 U (http://www.xmlspy.com) by Paul
Eden (Paradise Solutions) -->
<xs:schema elementFormDefault="qualified"
attributeFormDefault="unqualified"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Customers">
<xs:annotation>
<xs:documentation>Customer collection</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="Customer" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="CustomerID" type="xs:ID"/>
<xs:element name="CustomerCode">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="10"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="AddressCount" type="xs:int"/>
<xs:element name="Address" maxOccurs="unbounded">
<xs:complexType>
<xs:complexContent>
<xs:extension base="refAddress"/>
</xs:complexContent>
</xs:complexType>
</xs:element>
<xs:element name="CurrencyCode" type="xs:string" default="1"/>
<xs:element name="Balance" type="refBalance" default="0.00"/>
<xs:element name="CurrentBalance" type="refBalance" default="0.00"/>
<xs:element name="Balance1" type="refBalance" default="0.00"/>
<xs:element name="Balance2" type="refBalance" default="0.00"/>
<xs:element name="Balance3" type="refBalance" default="0.00"/>
<xs:element name="Balance4" type="refBalance" default="0.00"/>
<xs:element name="Balance5" type="refBalance" default="0.00"/>
<xs:element name="Balance6" type="refBalance" default="0.00"/>
<xs:element name="CreditLimit" type="refBalance" default="0.00"/>
<xs:element name="Hold">
<xs:simpleType>
<xs:restriction base="xs:string"/>
</xs:simpleType>
</xs:element>
<xs:element name="DefaultPriceStream" type="xs:int" default="1"/>
<xs:element name="UsrField1" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="50"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="UsrField2" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="50"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="CompanyID" type="xs:int" default="1"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:simpleType name="refPstnNumber">
<xs:annotation>
<xs:documentation>Simple type for telephone/fax</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:whiteSpace value="preserve"/>
<xsattern value="[+0-9 ]{11,16}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="refBalance">
<xs:annotation>
<xs:documentation>Simple type for account balances</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:float">
<xs:minInclusive value="0.00"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="refAddress">
<xs:annotation>
<xs:documentation>Complex Type for Addresses</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element name="AddressID" type="xs:ID"/>
<xs:element name="CustomerID" type="xs:ID"/>
<xs:element name="AddressName">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="40"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Number" type="xs:int"/>
<xs:element name="Addr1">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="40"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Addr2">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="40"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Town">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="40"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="County">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="40"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Postcode">
<xs:simpleType>
<xs:restriction base="xs:string">
<xsattern value="[A-Za-z]{1,2}[1-9][0-9]?[A-Za-z]?
[0-9][A-Za-z]{2}|GIR 0AA|NONUK"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Country" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="40"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="ContactName" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="40"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Telephone" type="refPstnNumber" minOccurs="0"/>
<xs:element name="Fax" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string"/>
</xs:simpleType>
</xs:element>
<xs:element name="Email" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="255"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="RepCode" type="xs:integer"/>
</xs:sequence>
</xs:complexType>
</xs:schema>