http://qs1969.pair.com?node_id=228361

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hello monks,

I need to parse several large XML files, and add more XML as needed. I have looked into both XML::Parse, and XML::Twig. The Twig module seems to be more low level, but unfortunately it doesn't work on my windows box.

Does anyone have any suggestions for another module that would accomplish the same thing?

Thanks

Replies are listed 'Best First'.
Re: XML::Twig, or something else?
by hotshot (Prior) on Jan 20, 2003 at 16:03 UTC
    It depends on what you wish to acomplish:
    from ajt's answer to similar question:

    Perl has many other excellent XML tools (including):

    XML::LibXML and XML::LibXSLT are also c based, and very fast - a particular favourite
    XML::DOM if you need a W3C DOM interface
    XML::GDOME if you need a DOM level 2 iterface
    XML::Parser if you want low level access to your XML
    XML::Sablotron another fast c based parser/XSLT engine
    XML::Simple a classic simple interface to XML in Perl
    XML::TreeBuilder a useful yet underused XML tree manipulation module
    XML::Twig another Perlish XML interface


    Hotshot
Re: XML::Twig, or something else?
by gjb (Vicar) on Jan 20, 2003 at 16:15 UTC

    XML::Twig 3.0.9 installs nicely under Windows NT (SP5) with ActiveState Perl 5.6.1 build 633 for me. If memory serves I also installed it under cygwin with that Perl distribution directly from CPAN.

    I must say I rather like XML::Twig's approach, although the other modules mentioned have their advantages too.

    Lastly, for large files, you may want to use the SAX interface rather than the DOM unless you've lots of memory to spare. In such situations, XML::Twig may be a nice compromise.

    Just my 2 cents, -gjb-

Re: XML::Twig, or something else?
by ajt (Prior) on Jan 20, 2003 at 16:18 UTC

    Hi Anon,

    You should find that XML::Twig works perfectly well on Windows. If you described the problems we may be able to make XML::Twig work for you too.

    As to other modules, one may ask how long is a piece of string? there are a lot to choose from, for example see this recent node of mine: Re: How to implement XML languages and nodes therein. It does depend on what you want to do as to what is the best solution, in particular I recommend Mirod's Ways to Rome as a useful place to start.


    --
    ajt
Re: XML::Twig, or something else?
by mirod (Canon) on Jan 20, 2003 at 17:24 UTC
Re: XML::Twig, or something else?
by OM_Zen (Scribe) on Jan 20, 2003 at 17:11 UTC
    Hi ,

    The perl distribution XML::Simple is versatile or you can try XML::SAX