in reply to xml to csv
You've encountered the silly "each XML document must have one and only one root tag" restriction. Let's see what do the XML::Rules docs say about that:
If you need to parse a XML file without the top-most tag (something that each and any sane person would allow, but the XML comitee did not), you can parseinstead.<!DOCTYPE doc [<!ENTITY real_doc SYSTEM "$the_file_name">]><doc>&rea +l_doc;</doc>
And the
is better writtenmap {$_[1]->{$_}} qw( Subject Course Title Description Prequisites Corequisites Requisites LectureHours LaboratoryHours CreditHours Flags )
No need to map(), just slice the hash.@{$_[1]}{qw( Subject Course Title Description Prequisites Corequisites Requisites LectureHours LaboratoryHours CreditHours Flags )}
You may also want to add the stripspaces => 3 to ensure the whitespace around the <Class> tags is not being accumulated in the $_[1]->{_content} for the handler of the root tag.
Jenda
Enoch was right!
Enjoy the last years of Rome.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: xml to csv
by Anonymous Monk on Nov 04, 2009 at 14:43 UTC |