A philosophical question

Y'all;

I am building a database of sorts using XML as the layout. Each record is a separate XML file. There is a single perl script (being called as cgi) that will access the record(s) in the database. On my linux system I am making links to this one script, and so the name is the "key" to the record(s) selected.

The "real" script (myxmldb.cgi) will show ALL records. But all of the "other" scripts will only show "their" records. So one of them (goober.cgi -> myxmldb.cgi) will show the ones with "goober" in the predefined "process-created" tag. Adding more stuff to the mixture, there is a "goober.xml" file that is an ini-file in xml format. Each database, then, can have it's own unique layout, all being accessed by the same script.

My plan was that when I wrote out the database record, I was going to update the built-in DTD information to match it's layout. But the XML::Twig process doesn't handle the DTD well enough. So I created a few more predefined tags to hold the list of fields, etc. All of this was so if I called the "main" script (myxmldb.cgi) that it could (easily) show ALL of the records, irrespective of the layout.

So with that (obtuse) description of where I am and what I'm trying to do, let me ask this:

Is it better to keep the DTD type information internal to the XML file, or as a separate file? I'm interested in how hard it is to keep them up-to-date if they are separate as opposed to how easy is it when they're together. And then how that works with the fact that XML::Twig doesn't handle the DTD.

In other words, how do y'all handle this?

I am working on my first XML project. The reference project I'm using as a base had the DTD information included in the XML files, so that's how I started off. I've got 27 years of programming experience, so I'm not afraid to tackle something bad|ugly to take care of things. I'm just interested in the feelings from this forum in this area. I have the luxury ot going either way at this point.

Thanks to the perlmonks group. I stumbled on this site via some of the on-line docu for XML::Twig -- which, btw, I am finding quite usable! (thanks!!) From what I've seen so far, this is a great site!

Lee


In reply to XML and DTD and Twig... by lee_crites

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.