Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to convert XSD file to XLS

Tags:

xml

excel

xsd

I have a XSD file and I need to convert that to MS Excel file. The XSD is below.

<?xml version="1.0" encoding="ISO-8859-1" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

<xs:element name="shiporder">
  <xs:complexType>
    <xs:sequence>
      <xs:element name="orderperson" type="xs:string"/>
      <xs:element name="shipto">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="name" type="xs:string"/>
            <xs:element name="address" type="xs:string"/>
            <xs:element name="city" type="xs:string"/>
            <xs:element name="country" type="xs:string"/>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="item" maxOccurs="unbounded">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="title" type="xs:string"/>
            <xs:element name="note" type="xs:string" minOccurs="0"/>
            <xs:element name="quantity" type="xs:positiveInteger"/>
            <xs:element name="price" type="xs:decimal"/>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
    <xs:attribute name="orderid" type="xs:string" use="required"/>
  </xs:complexType>
</xs:element>

</xs:schema>

Pls help me, I really don't know how and where to start.

like image 769
praveen kumar Avatar asked Aug 12 '12 07:08

praveen kumar


2 Answers

This answer is equally for you as well as @Alex, @Michael and @forty-two. I am illustrating it using Excel 2010, so if you're on another version, I'll leave it up to you to make the necessary adjustments.

First thing, make sure the developer tab shows (Click the File tab, Options).

Excel 2010 options for Developer tab

You now have to create an XML source from your XSD: click the Developer tab; in the XML group, toggle Source button to show the Xml Source task pane; then click the XML Maps button.

Excel showing key UI elements for creating an XML map

Click Add button at the prompt; point to the XSD file; then click OK to go back to the main screen.

Excel showing XSD loaded in an XML map

Then you can drag and drop your shipOrder to a cell in a worksheet, to anchor the generated mapped table.

Excel showing mapped XSD

Next, you may use Import to get your XML data into the spreadsheet, and Export to get it out. There are a couple of additional things to pay attention to; read this article on Microsoft's site; pay particular attention to the issues with exporting XML data (error XML maps in my workbook are not exportable). This is because of the 1 to many cardinality between shiporder and item. You can try to handle it using mapped ranges - I'll leave this all up to you. The best would be for you to read the online help for the XML developer section...

like image 169
Petru Gardea Avatar answered Oct 18 '22 21:10

Petru Gardea


Go to MS Excel -> File -> Open. Select the xsd file.

You will be prompted on how you would like to open the file. You can select the option 'As an XML table'. Save the file in excel format.

like image 23
Ashwath Padmashali Avatar answered Oct 18 '22 19:10

Ashwath Padmashali