![]() |
|
|
|||||||
![]() |
XML - CSV with multiple header rows to XML |
|
|
Thread Tools | Search this Thread |
|
|
#1 |
|
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. Alan_C |
|
|
|
|
#2 |
|
Posts: n/a
|
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 |
|