Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??


XML::DOM is a Perl implementation of W3C's DOM Level 1.

It is one of the most widely used Perl XML modules. It is included in libxml-enno

XML::DOM adds some Perl specific features to the W3C recommendation.

Why use XML::DOM?

  • you want to follow the W3C recommendation
  • you want to use one of the most stable XML modules in Perl
  • you already know the DOM, or you want to be able to use the same API in Java and in Perl in the future you want to interface easily with XML data bases
  • you are seriously masochistic!

Why NOT use XML::DOM

  • you have to process huge documents
  • you need speed
  • the DOM API is ugly!

Related Modules

  • XML::XQL::DOM adds XQL support to XML::DOM.
  • XML::DOM::ValParser uses XML::Checker to validate doccuments at parse time.
  • XML::EasyOBJ is a module built on top of XML::DOM with a simpler and more perlish interface. This kind of module is an excellent idea: it gives you the ease of programming of the Perl way while preserving DOM compatibility,
  • XML::DOM::Twig: a little module I wrote (it's not yet on CPAN) to emulate some of XML::Twig functions with XML::DOM, making it easier (and safer) to use.

Personal notes

I don't like the DOM API at all! I think the model is clean but for some reason the interface is clunky and too verbose. It is extremely Java oriented, from the names of methods to the type of object they return.

That said XML::DOM is a robust module, widely used and well designed. Plus the DOM is generally well documented and some nice tutorials are available.

Warning: there are compatibility problems between various versions of XML::DOM and XML::Parser. The valid combinations are XML::Parser 2.30 + XML::DOM 1.33 and above or XML::Parser 2.30 + XML::DOM 1.29 (included in libxml-enno) or XML-Parser 2.27 (included in Activestate Perl on Windows) + XML::DOM 1.25 (the stand-alone version not included in libxml-enno).

In reply to XML::DOM by mirod

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, 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, 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.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others examining the Monastery: (9)
    As of 2015-11-26 11:02 GMT
    Find Nodes?
      Voting Booth?

      What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

      Results (697 votes), past polls