CSV with multiple header rows to XML

Discussion in 'XML' started by Alan_C, Sep 10, 2006.

  1. Alan_C

    Alan_C Guest

    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, Sep 10, 2006
    #1
    1. Advertising

  2. 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
     
    Joe Kesselman, Sep 10, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Schultz
    Replies:
    1
    Views:
    515
    Karl Seguin
    Feb 14, 2005
  2. Michal Mikolajczyk
    Replies:
    0
    Views:
    661
    Michal Mikolajczyk
    Feb 13, 2004
  3. mlt
    Replies:
    2
    Views:
    854
    Jean-Marc Bourguet
    Jan 31, 2009
  4. VijayRama
    Replies:
    2
    Views:
    2,333
    Gregory A. Beamer
    Oct 12, 2009
  5. Alfred Salton

    Multiple Header rows in datagrid

    Alfred Salton, Jul 15, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    2
    Views:
    357
    Alfred Salton
    Jul 15, 2004
Loading...

Share This Page