http://www.perlmonks.org?node_id=948111


in reply to Re^7: Is there any XML reader like this? (XML::Simple beats LibXML hands down in the speed stakes!)
in thread Is there any XML reader like this?

If you don't need to do that sort of stuff, then perhaps there's a mismatch between your needs and XML::LibXML's aims.

Finally, we agree on something.

Most, not all, but most, of my XML needs are for gaining read-only access to relatively small volumes of simple data. Unencoded, with no namespaces or CDATA with no need to look at comments. Mostly configuration data, RDF feeds and similar. Things for which XML::Simple is ideal and XML::LibXML is simply overkill.

Ie. Exactly the sort if simple XML shown by the OP above. The same data for which you suggested he abandon the simple, easy to use, clearly documented tool he was using in favour of an the over-engineered, horribly documented, behemoth of a chainsaw that is XML::LibXML.

Just as I don't use a chainsaw to trim my toenails, I use the XML tool that suits my purpose.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

The start of some sanity?

Replies are listed 'Best First'.
Re^9: Is there any XML reader like this? (XML::Simple beats LibXML hands down in the speed stakes!)
by Jenda (Abbot) on Jan 16, 2012 at 12:11 UTC

    I would recommend having a look at XML::Rules. Not only it can match the (assumed) simplicity of XML::Simple thanks to its ability to infer a default set of transformation rules from examples or a DTD, ensuring consistency of the datastructure built even with XMLs containing optionally repeated tags or optional attributes, but it allows you to tweak the datastructure built from your XML to better suit your needs and, should the files get too big, allows you to trim and/or process the datastructure as it's being built.

    Jenda
    Enoch was right!
    Enjoy the last years of Rome.

Re^9: Is there any XML reader like this? (XML::Simple beats LibXML hands down in the speed stakes!)
by ikegami (Patriarch) on Jan 16, 2012 at 20:06 UTC

    "Unencoded"? XML::Simple doesn't handle such broken XML.

    $ perl -MXML::Simple -e'XMLin("<root><foo>\xE9</foo></root>");'
    Entity: line 1: parser error : Input is not proper UTF-8, indicate encoding !
    Bytes: 0xE9 0x3C 0x2F 0x66
    <root><foo>�</foo></root>
               ^
    

    Just as I don't use a chainsaw to trim my toenails, I use the XML tool that suits my purpose.

    I didn't not try to get you to use XML::LibXML. I was just contradicting obviously incorrect information.

      I was just contradicting obviously incorrect information.

      "contradict". Far from it. You proved it for me.

      NOW, just stop!


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

      The start of some sanity?