Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > CSV with multiple header rows to XML

Reply
Thread Tools

CSV with multiple header rows to XML

 
 
Alan_C
Guest
Posts: n/a
 
      09-10-2006
Hi,
Using Perl I converted a few simple, single header, csv to xml.

But I have a csv file that has:

Header,row,#1
data_row,under,header_1
nuther_data_row,under,header_1
Header,row,number,two
data_row,under,header,2
nuther_data_row,under,header,2


Note that the header rows differ in their number of columns.

Does xml support multiple and somewhat/slightly differing header rows as
well as corresponding/matching format data like the example above? If
yes, what does an xml equivalent of the above csv example look like?

Or would it be up to a style sheet to coordinate/designate which rows
in the xml are the header rows?

This csv file has near 6 or 7 different header rows with corresponding
data row/columns as per the example above.

This csv file converts to html alright. The html is merely tables with
every so often is a new header row with corresponding data rows below
each header.

But, so far, my use of Perl to attempt this particular csv to xml fails.

I suspect that this AnyData.pm Perl module grabs the first header row,
expecting it to be the only header row. Anyways, it dies, reporting
"invalid xml", produces an empty output file.

Thanks.
--
Alan.
 
Reply With Quote
 
 
 
 
Joe Kesselman
Guest
Posts: n/a
 
      09-10-2006
Alan_C wrote:
> Does xml support multiple and somewhat/slightly differing header rows


XML itself has no concept of "rows", header or otherwise. That would be
defined by the language you use XML to implement.

> what does an xml equivalent of the above csv example look like?


Whatever the person who designs that particular XML markup wants it to
look like. There are multiple good solutions here depending on what you
actually want to do with the data. One would be to borrow HTML's table
tagging and extend it as necessary to support the sub-headers; another
would be to treat it as a table of tables each having their own headers;
or you might want to do something completely different.

> Or would it be up to a style sheet to coordinate/designate which rows
> in the xml are the header rows?


The stylesheet is written to match the specific XML markup.

> But, so far, my use of Perl to attempt this particular csv to xml fails.
> I suspect that this AnyData.pm Perl module


Since you're using someone else's code, check the documentation for
their code to find out whether it supports this. If not, you may need to
modify that solution or write your own.

--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hide the Gridview Rows and Header rows in Button click VijayRama ASP .Net 2 10-12-2009 01:58 PM
Header files with "header.h" or <header.h> ?? mlt C++ 2 01-31-2009 02:54 PM
showing multiple values from multiple db rows in a DropDownList Schultz ASP .Net 1 02-14-2005 12:38 AM
Multiple Header rows in datagrid Alfred Salton ASP .Net Datagrid Control 2 07-15-2004 09:16 PM
csv writerow creates double spaced excel csv files Michal Mikolajczyk Python 0 02-13-2004 08:38 PM



Advertisments