XML::Table2XML

XML::Table2XML is a Perl module for generic conversion of tabular data to XML by reverting Excel's flattener methodology.
Download

XML::Table2XML Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Roland Kapl
  • Publisher web site:
  • http://search.cpan.org/~rkapl/XML-Table2XML-1.0/Table2XML.pm

XML::Table2XML Tags


XML::Table2XML Description

XML::Table2XML is a Perl module for generic conversion of tabular data to XML by reverting Excel's flattener methodology. XML::Table2XML is a Perl module for generic conversion of tabular data to XML by reverting Excel's flattener methodology.SYNOPSIS use XML::Table2XML; my $outXML = ""; # first parse column path headers for attribute names, id columns and special common sibling mark ("//") parseHeaderForXML("rootNodeName", ); # then walk through the whole data to build the actual XML string into $outXML my @datarows = (, , ); for my $lineData (@datarows) { $outXML.=addXMLLine($lineData); } #finally finish the XML and reset the static vars $outXML.=addXMLLine(undef); print $outXML; # yields: # < ?xml version="1.0"? > # < rootNodeName id="1" name2="testName" >< a >testA< /a >testB< /a >< a >testC< /a >< /rootNodeName >table2xml is an algorithm having two functions that allow the conversion of tabular data to XML without using XSLT. This is achieved by reverting the "Flattener" methodology used by Microsoft Excel to convert the XML tree format to a two-dimensional table (see Opening XML Files in Excel and INFO: Microsoft Excel 2002 and XML).This reversion is achieved by:1. (possibly) modifying the flattened table a bit to enable a simpler processing of the data,2. sequentially processing the data column- and row wise.The whole algorithm is done without the aid of any XML library, so it lends itself to easy translation into other environments and languages.Producing the XML:1. invoke parseHeaderForXML, using a line with the rootnode and path information.2. After parsing the header info, the table data can be processed row by row by calling addXMLLine. The current data row is provided in the single argument lineData, the built XML is string returned and can be collected/written.3. A final call to addXMLLine with lineData == undef restores the static variables and finalizes the XML string (closes any still open tags). Requirements: · Perl


XML::Table2XML Related Software