473,395 Members | 1,999 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

CSV with multiple header rows to XML

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.
Sep 10 '06 #1
1 2078
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
Sep 10 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Billy Jacobs | last post by:
I am using a datagrid to display some data. I need to create 2 header rows for this grid with columns of varying spans. In html it would be the following. <Table> <tr> <td colspan=8>Official...
1
by: sri_san | last post by:
Hello, I have a datagrid in which the header needs to span over 2 columns. I have tried creating a tableCells and tableRow at runtime and set the columnspan property of a cell to 2. But, the...
0
by: =?Utf-8?B?U3RldmU=?= | last post by:
C# I have a datagrid, and the users are able to select multiple rows and perform an action. This works fine, as I get the rows selected using something like this: CurrencyManager xCM =...
2
by: Astrat | last post by:
I am trying to hightlight multiple rows in a report design with specific data. For example, I want to hightlight weekends (i.e. Saturday, Sunday) in yellow. I can accomplish this with the...
0
by: acarrazco | last post by:
Hello, I am totaly new to VBA and I'm trying to modify a macro that was given to me but it doesn't seem to be working. I'm trying to extract data from three excel spreadsheets, put it into a combined...
2
by: Michael | last post by:
It seems that a gridview allows us to delete only a single row at a time. How to extend this functionality to select multiple rows and delete all of the selected rows in a single stroke? just like...
7
by: jfkjfk | last post by:
Hello, I am trying to make a page with a design as follows: page is centered horizontaly with a total width of 1000 - a Header on top - a Footer at the bottom - in between the header and the...
2
by: ravir81 | last post by:
Hi, I am working on excel reporting using Perl. I am facing problem with writing the header part only once for all the excels created using Perl. Here is the code : ...
3
by: didi86 | last post by:
Please help me to adding multiple row at a time... // Last updated 2006-02-21 <script language="javascript"> function addRowToTable() { var tbl = document.getElementById('tblSample'); ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.