Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

How to format this xml output?

by sen (Hermit)
on Jan 23, 2006 at 11:28 UTC ( #524897=perlquestion: print w/ replies, xml ) Need Help??
sen has asked for the wisdom of the Perl Monks concerning the following question:

Hi,

I am new to perl. I tried lot. I have some xml file. I have to parse the xml file and insert the fields into database. I use XML::Simple to parse the data. It's working fine. I am getting output like this

one => 1, two => [ { x => 1, y => [ { a => 1, b => 2 }, { a => 2, b => 3} ] } ]

But, I need to insert into my database like this below. Please give me some ideas.
one => 1, two => [ { x => 1, y_a => 1, y_b => 2, }, { x => 1, y_a => 2, y_b => 3 } ]

Comment on How to format this xml output?
Select or Download Code
Re: How to format this xml output?
by glasswalk3r (Pilgrim) on Jan 23, 2006 at 12:20 UTC

    It would be better if you provide a sample of your XML and the database table that you want to insert data. In both cases, this has nothing to do with format XML output (I thought it was something related to XSL).

    Once you have the data in array ref, you just need to extract the data that you want dereferencing it. Looks like the XML file that you have doesn't have the same structure of the database table, so you will need to do some data transformation.

    Take a good look at the perldoc perlref document to see how to do that.

    Alceu Rodrigues de Freitas Junior
    ---------------------------------
    "You have enemies? Good. That means you've stood up for something, sometime in your life." - Sir Winston Churchill
Re: How to format this xml output?
by planetscape (Canon) on Jan 24, 2006 at 06:58 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://524897]
Approved by gube
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (8)
As of 2014-08-01 23:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Who would be the most fun to work for?















    Results (52 votes), past polls