FAQ
Does anyone have suggestions for an active and easy to use XML building & parsing module?

Doug Bradbury

Search Discussions

  • Rob Dixon at Jul 12, 2011 at 9:08 pm

    On 12/07/2011 19:07, Doug Bradbury wrote:
    Does anyone have suggestions for an active and easy to use XML
    building & parsing module?
    Hi Doug

    Any code to write XML ends up looking very similar to the resulting XML
    itself, although XML::Writer will make sure your syntax is correct for
    you and avoid a lot of obvious errors.

    As for parsing, it largely depends on what you want to do once you have
    parsed tha XML. But XML::LibXML is a good all-rounder (although with
    awkward documentation). XML::Twig and XML::TreeBuilder are also worth a
    look.

    HTH,

    Rob
  • Feng He at Jul 13, 2011 at 1:27 am

    2011/7/13 Doug Bradbury <dbradbury@8thlight.com>:
    Does anyone have suggestions for an active and easy to use XML building & parsing module?
    For a simple XML parsing I have used the module XML::Simple which just run well.

    Regards.
  • Rob Coops at Jul 13, 2011 at 8:11 am

    On Wed, Jul 13, 2011 at 3:27 AM, Feng He wrote:

    2011/7/13 Doug Bradbury <dbradbury@8thlight.com>:
    Does anyone have suggestions for an active and easy to use XML building &
    parsing module?
    For a simple XML parsing I have used the module XML::Simple which just run
    well.

    Regards.

    --
    To unsubscribe, e-mail: beginners-unsubscribe@perl.org
    For additional commands, e-mail: beginners-help@perl.org
    http://learn.perl.org/

    Recently having done some work with various XML libraries in perl I have to
    recommend: XML::LibXML the documentation is well how to put it not
    fantastic... but once you get passed that you are looking at probably the
    fastest and most powerful library for XML parsing available in perl.

    It really depends on what you are looking to do though, if you are aiming
    for just a simple thing with only a few messages then don't worry
    about XML::LibXML
    and go for XML::Simple which is more then enough in most simple cases ;-)
    I found that both Twig and Treebuilder are great if you are looking at
    modifying the XML (add extra nodes, alter existing nodes) but since they
    build a full tree structure for the XML file you are working with depending
    on the size and complexity of the file this could cause serious memory
    bloat, and even out of memory errors.

    Personally I think that if you can stomach it getting past the somewhat
    difficult XML::LibXML documentation it will provide you the best and fastest
    way of working with XML files, but I have to be honest it took me several
    years before I found a project where I needed the speed and power of LibXML.
    On the other hand once learned... if you have the time to do so have a go at
    it you will enjoy working with it once you know how to.

    Regards,

    Rob
  • Jenda Krynicky at Jul 20, 2011 at 11:15 pm
    From: Rob Coops <rcoops@gmail.com>
    It really depends on what you are looking to do though, if you are aiming
    for just a simple thing with only a few messages then don't worry
    about XML::LibXML
    and go for XML::Simple which is more then enough in most simple cases ;-)
    Except that it's not so simple to set it up to give you consistent
    data structure with things like optional tag attributes and repeated
    tags. See http://www.perlmonks.org/?node_id=697036
    I found that both Twig and Treebuilder are great if you are looking at
    modifying the XML (add extra nodes, alter existing nodes) but since they
    build a full tree structure for the XML file you are working with depending
    on the size and complexity of the file this could cause serious memory
    bloat, and even out of memory errors.
    XML::Twig (as the name suggests) is not supposed to build a full tree
    structure, but rather lets you work with parts of the document. The
    "twigs".

    I personally believe XML::LibXML is overcomplicated, but some people
    seem to like it.

    Jenda
    ===== Jenda@Krynicky.cz === http://Jenda.Krynicky.cz =====
    When it comes to wine, women and song, wizards are allowed
    to get drunk and croon as much as they like.
    -- Terry Pratchett in Sourcery

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupbeginners @
categoriesperl
postedJul 12, '11 at 6:07p
activeJul 20, '11 at 11:15p
posts5
users5
websiteperl.org

People

Translate

site design / logo © 2021 Grokbase