Popcorn Dave has asked for the wisdom of the Perl Monks concerning the following question:
Fellow monks,
Revolution. Today, 3 O'Clock. Meet behind the monkey bars.
I'm finally getting my feet wet with XML by trying to combine two XML files in to one. So far so good, but when I write the XML file back, attribute indentation in XML::Simple is being ignored.
open FH, ">", "webcams.xml"; print FH XMLout($combined, KeyAttr => {AttrIndent => 1, xmldecl => '<?xml version="1.0" encoding=" +UTF-8"?>',}); close FH;
As it stands, the code is printing the XML as this:
According to the docs, unless I misread them, the AttrIndent => 1 should indent the tags so it looks like this:<opt class="java.beans.XMLDecoder" version="1.6.0-oem"> <object class="java.util.HashSet"> <void method="add" string="baseball" /> <void method="add" string="football" /> </object> </opt>
<java version="1.6.0_02" class="java.beans.XMLDecoder"> <object class="java.util.HashSet"> <void method="add"> <string>baseball</string> </void> <void method="add"> <string>football</string> </void> </object> </java>
What have I overlooked to get the indentation to work as in the second XML example?
Thanks in advance!
Revolution. Today, 3 O'Clock. Meet behind the monkey bars.
I would love to change the world, but they won't give me the source code
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: XML::Simple attribute indentation not working
by andreas1234567 (Vicar) on Sep 23, 2007 at 07:35 UTC | |
Re: XML::Simple attribute indentation not working
by Anonymous Monk on Sep 23, 2007 at 07:27 UTC | |
Re: XML::Simple attribute indentation not working
by Popcorn Dave (Abbot) on Sep 24, 2007 at 16:29 UTC |
Back to
Seekers of Perl Wisdom