[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Converting Excel Table to XML document

  • From: Chin Chee-Kai <cheekai@s...>
  • To: Oscar Rodriguez <orodriguez@i...>
  • Date: Fri, 19 Dec 2008 10:13:42 +0800

Re:  Converting Excel Table to XML document
Title: Re: XML Schema: "Best used with the ______ tool"
You can run a simple tool UBLish v2.0.alpha [1] to convert Excel spreadsheet into a generic XML-Spreadsheet format, then do your  XSLT to transform the raw XML  form into your intended format.  Description of XML-Spreadsheet format (which is a simple format) can be found at [2].  When you run UBLish, just click on:

    Spreadsheet Conversion --> To XML-Spreadsheet --> Convert A Spreadsheet

and you will be prompted to select the input source Excel spreadsheet.  You will be asked whether there is a header row label to generate.  For your case, it would seem you can enter "1" to indicate Row 1 contains header labels to be reproduced in the <Column> attributes (please see below).


An outline of the generic XML-Spreadsheet format  using your sample data would look like:
<Sheet>
<Information>
  <Filename>MyTable.xls</Filename>
  <GeneratedBy>UBLish v2.0.0.kpo</GeneratedBy>
  <GeneratedOn>20081219 101332</GeneratedOn>
</Information>
<Row rowIndex="1">
  <Column rowIndex="1" columnIndex="1" columnLabel="SourceApp">SourceApp</Column>
  <Column rowIndex="1" columnIndex="2" columnLabel="TargetApp">TargetApp</Column>
</Row>
<Row rowIndex="2">
  <Column rowIndex="2" columnIndex="1" columnLabel="SourceApp">Competitor</Column>
  <Column rowIndex="2" columnIndex="2" columnLabel="TargetApp">Commercial</Column>
</Row>
<Row rowIndex="3">
  <Column rowIndex="3" columnIndex="1" columnLabel="SourceApp">Partner</Column>
  <Column rowIndex="3" columnIndex="2" columnLabel="TargetApp">Business Partner</Column>
</Row>
</Sheet> 
You can then transform this into any customized form using XSLT.

Alternatively, since UBLish is open-sourced scripting, you can edit the XML-Spreadsheet generation function so that it generates directly the XML template you want (sort of merging Excel-->XML-->XSLT into the script).  To do this, use your favorite line editor to open the file "bin\UBLish-v2.0.alpha.kpo" and search for "<Sheet>".  That will bring you to the function that performs the XML generation, at which point you can edit it to your desire.


Hope this is useful to you.


Regards,
Chin Chee-Kai


[1] UBLish v2.0.alpha download, http://sourceforge.net/project/showfiles.php?group_id=238704&package_id=292341&release_id=631432
[2] Description of XML-Spreadsheet format, http://sourceforge.net/forum/forum.php?thread_id=2257107&forum_id=863486


Oscar Rodriguez wrote:
84DC60601283074B9194BACBBC3E8751273748@B..." type="cite">

Hi - I have the following reference table in Excel

SourceApp    TargetApp

Competitor   Commercial
Partner        Business Partner
...

Does anyone know an easy way to convert the above table to an XML that looks as follows?

<?xml version="1.0" encoding="UTF-8"?>
<dvm name="Customer" isNew="null">
  <description>DVM description</description>
  <columns>
     <column name="SourceApp"/>
     <column name="TargetApp"/>
  </columns>
  <rows>
    <row>
      <cell>Competitor</cell>
      <cell>COMMERICAL</cell>
    </row>
  </rows>
</dvm>


Thanks in advance
- Oscar

 


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.