In my case, each file will be one record. That record could belong to any "database" I have. I have defined (for myself) certain fields (e.g. 'name' or 'city') that have predefined meaning and a common layout. I put that layout into a global INI type file that all scripts will access. When a new (and unique) field is added to any database, I stick that into the global file as well. So there is one file (voc.xml) that has every field name and all of it's particular layout definitions.

What I am doing is to write a single display and edit CGI script. It will read in the voc.xml file, and then somehow (automagically) know what to do with the record. This worked just fine before the migration to XML, so I know the process works, I'm just trying to find the "best practice" for the XML world in duplicating it.

It seemed to me that the perfect place to do this was in the DTD. Each database would have a DTD file that contained a list of all of the fields it used, etc. But how do I tie the record I am processing to the DTD that relates to it? The internal DTD info seemed like the perfect location for that as well. But XML::Twig didn't process it correctly, and when I looked, I found out that this was a known problem.

But my philosphical question remains: what's the best practice for linking the data file to the DTD file? I can read the documentation, but so far I haven't really gotten a good feel for what is really being done by those folks who are actually using this.

Lee Crites
lee@critesclan.com

In reply to Re^2: XML and DTD and Twig... by lee_crites
in thread 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.