Hi.

I have recently used XML::DTDParser for a project and I found that it was exactly what I was looking for. It provides a convenient Perl datastructure representing a DTD which does exactly what you want: parses a DTD. There is no extra "fluff" or additional functionality which gets in the way of achieving what you want.

This said, I was not concerned with performance, nor was I writing code which I expected to be extensively reused in other projects (or reviewed by other developers). I was just writing a quick and dirty script to solve a problem, which is I believe exactly what XML::DTDParser's author (Jenda) had in mind when writing this module.

If you want something simple, I would recommend XML::DTDParser. If you are after a more complete XML library, I would look into XML::LibXML.

I hope this helps.

Cheers,

-- Dave :-)


$q=[split+qr,,,q,~swmi,.$,],+s.$.Em~w^,,.,s,.,$&&$$q[pos],eg,print

In reply to Re: DTD for XML - What is the best parser? by DaveH
in thread DTD for XML - What is the best parser? by gmpassos

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.