FWIW, I use XML::Xerces::DOMParser, and build things that way. I write wrapper classes for each broad category of XML tag I want to generate.

These classes have get/set methods which just manage some anon hashes in my class's instance data. I also have two methods - getXML and parseXML, which output the entire tree and snarf in a new tree, respectively.

getXML essentially converts my perl-friendly hash representation of the XML tree into a Xerces DOM, then returns the text representation. parseXML does the opposite - snarfs into a DOM and moves it into a nice perl hash. I've never used a DTD, so I'm not sure how far my idea would get you on that front. But as far as a way for "methods and stuff to do the tag work for you", I think it works okay.

Out of interest, how can a DTD help me? What does it bring to the table?

--
Ash OS durbatulk, ash OS gimbatul,
Ash OS thrakatulk, agh burzum-ishi krimpatul!
Uzg-Microsoft-ishi amal fauthut burguuli.


In reply to Re: RFC : XML::Generator::FromDTD by hagus
in thread RFC : XML::Generator::FromDTD by boo_radley

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.