Get a better (faster) parser, such as XML::LibXML. Using XML::XSH2, I loaded and saved that file, and the result was:
<?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)-&gt;::mtl_param:common +:0:w"/> <desc>controls --&gt; 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>
And using the XSH2 language, I could have modified the tree with a mixture of XPath loops and Perl expressions. It's quite elegant, and even compiles down to Pure Perl code.

I have an article on using xsh2 to scrape HTML as well (embargoed at the moment, should go live in a few weeks).


In reply to Re: XML gurus unite!! by merlyn
in thread XML gurus unite!! by jmmistrot

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.