I have no problem reading things in with XML-Simple<?xml version="1.0" encoding="utf-8"?> <AttributeDatabase> <attribclass toolonly="false" hidden="false" dbvault="true"> <editlist name="default"> <entry>*</entry> </editlist> <preferrededitlist>"default"</preferrededitlist> <attribdef name="mtl_param" synthetic="true" array="true"> <desc>IsSynthetic</desc> <type>Attrib.Types.Vector4</type> <bound>True</bound> <properties platform="common"> <mincount>2</mincount> <maxcount>2</maxcount> </properties> </attribdef> <attribdef name="mtl_Kdiff" toolonly="true"> <memberkeyvalue path="" key="push(bits)->::mtl_param:common +:0:w" /> <desc>controls --> mtl_param[0].w </desc> <type>EA.Reflection.Float</type> <bound>False</bound> <increment>0.001</increment> <properties platform="common"> <max>2.0</max> <min>0.0</min> <defaultreflectedobject>1.0</defaultreflectedobject> </properties> </attribdef> </attribclass> </AttributeDatabase>
I do stuff to it... and then go to write it out thus:my $fh; open( $fh , "<", $arg{file}) or die; my $xml = XML::Simple->new(KeepRoot=>1) ; my $xml_data = $xml->XMLin($fh);
but no matter which options I try with XML-Simple I can't reconstruct the same XML output as input. The closest I have come is:my $xml = XML::Simple->new(XMLDecl=>1,KeepRoot=>1) ; my $xml_data = $xml->XMLout($arg{data});
Notice how the embedded element attributes in the attribclass and attribdef tags drop out. and my quotes(") become " or drop out altogether... Does anyone know how to keep some attributes from dropping out of element tags and others let go? I am afraid I am gonna have to write out each element as I traverse the data structure so that can control the output of XMLout(). Anyone got any advice? Your humble DTD Destroyer, jmm<?xml version='1.0' standalone='yes'?> <AttributeDatabase> <attribclass> <attribdef> <name>mtl_Kdiff</name> <bound>False</bound> <desc>controls --> mtl_param[0].w </desc> <increment>0.001</increment> <memberkeyvalue> <key>push(bits)->::mtl_param:common:0:w</key> <path></path> </memberkeyvalue> <properties> <defaultreflectedobject>1.0</defaultreflectedobject> <max>2.0</max> <min>0.0</min> <platform>common</platform> </properties> <toolonly>true</toolonly> <type>EA.Reflection.Float</type> </attribdef> <attribdef> <name>mtl_param</name> <array>true</array> <bound>True</bound> <desc>IsSynthetic</desc> <properties> <maxcount>2</maxcount> <mincount>2</mincount> <platform>common</platform> </properties> <synthetic>true</synthetic> <type>Attrib.Types.Vector4</type> </attribdef> <dbvault>true</dbvault> <editlist> <name>default</name> <entry>*</entry> </editlist> <hidden>false</hidden> <preferrededitlist>"default"</preferrededitlist> <toolonly>false</toolonly> </attribclass> </AttributeDatabase>
In reply to XML gurus unite!! by jmmistrot
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |