Hi,
I am trying to generate an XML from and Excel sheet which conforms to a XSD (Excel Schema Definition). There is an in-built feature in Excel-2010to do so but it doesn't work with a complex XSD. And gives following error -
"Cannot save or export XML data. The XML maps in this workbook are not exportable"
Following is the XSD code that i am using. In short, this is how xsd is written, there is a customer which has id, name and address. Address has addressline, city, state and zip. customer also has an order which has id, date and product. Product has name and quantity.
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="Root">
<xsd:complexType>
<xsd:sequence>
<xsd:element minOccurs="0" maxOccurs="unbounded" name="Customer">
<xsd:complexType>
<xsd:sequence>
<xsd:element minOccurs="0" maxOccurs="1" type="xsd:string" name="Id" />
<xsd:element minOccurs="0" maxOccurs="1" type="xsd:string" name="Name" />
<xsd:element minOccurs="0" maxOccurs="1" name="Address">
<xsd:complexType>
<xsd:sequence>
<xsd:element minOccurs="0" maxOccurs="1" type="xsd:string" name="AddressLine" />
<xsd:element minOccurs="0" maxOccurs="1" type="xsd:string" name="City" />
<xsd:element minOccurs="0" maxOccurs="1" type="xsd:string" name="State" />
<xsd:element minOccurs="0" maxOccurs="1" type="xsd:string" name="zip" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element minOccurs="0" maxOccurs="unbounded" name="Order">
<xsd:complexType>
<xsd:sequence>
<xsd:element minOccurs="0" maxOccurs="1" type="xsd:string" name="Id" />
<xsd:element minOccurs="0" maxOccurs="1" type="xsd:string" name="Date" />
<xsd:element minOccurs="0" maxOccurs="unbounded" name="Product">
<xsd:complexType>
<xsd:sequence>
<xsd:element minOccurs="0" maxOccurs="1" type="xsd:string" name="Name" />
<xsd:element minOccurs="0" maxOccurs="1" type="xsd:string" name="Quantity" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
Questions:
1. Why is the error ? Please suggest solution(s)
2. Does the XML generation not work for complex XSD's ?
3. I am googling out any VB code to programatically generate an XML from Excel using this XSD but not able to find anything so far.
Please help at the earliest.
Bookmarks