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

Brethren

What's a smart way of annotating the meta-info in a DTD? And what CPAN modules should I use – if any?

I've got XML records for a code-inspection. They are spec'ed in a DTD. The DTD says, for instance, that

And so on. I want to store annotations that assert presentation data for an editing GUI like: Clearly, this info doesn't belong in the DTD or the XML file. I'm currently storing it an ugly HoH that I grew myself. I suspect I'm re-inventing the wheel, here. But my Super Searching and my CPAN searching didn't turn up anything. Except a ref to Xforms which looks like it will be what I need, someday in the future. Am I using the wrong keywords to search?

BTW, I'd convert from DTD to another form like XML-Schema or RelaxNG if that would help. But, near as I can tell, they don't separate the specification of the data from the specification of the presentation/editing of the data, either.

thanks
throop

Replies are listed 'Best First'.
Re: Annotating XML Metadata for display
by pajout (Curate) on Sep 07, 2007 at 21:06 UTC
    Though I don't understand whole issue, I think that it is good challenge for XSLT (xsl transformation). The templates can match 'special' entities and present them proprietary processed. Aditionally, you can provide enumeration of inspectors as additional xml data or use some XIncludes...
Re: Annotating XML Metadata for display
by Jenda (Abbot) on Sep 09, 2007 at 09:15 UTC

    How do you parse the DTD? If you happened to use XML::DTDParser you could stick the annotations into <!--#info element=XXX key="value" ...--> comments into the DTD. This allows you to attach any additional data to the hash created by DTD::Parser for each tag or attribute. So using this you can store the stuff withing the DTD, yet other DTD parsers and XML validators with gracefully ignore it.

      Jenda,

      Thanks, that sounds like the ticket.