OK, I should have known I'd be challenged.

Here's my thinking. Although XML is often used for traditional two-dimensional row-and-column data, it doesn't have to be. It can have arbitrary levels of nestedness, extra dimensions.

So if you take this XML

<items> <item> <foo>a</foo> <bar>b</bar> <baz>c</baz> </item> <item> <foo>x</foo> <bar>y</bar> <baz>z</baz> </item> </items>
which follows this DTD:
<!ELEMENT bar (#PCDATA)> <!ELEMENT baz (#PCDATA)> <!ELEMENT foo (#PCDATA)> <!ELEMENT item (foo, bar, baz)> <!ELEMENT items (item+)>
Yes, it's pretty much plain sailing to generate the HTML.

But what about this?

<items> <item> <foo>a</foo> <bar>b</bar> <baz>c</baz> <item> <!-- items can contain sub-items --> <foo>d</foo> <bar>e</bar> <baz>f</baz> </item> </item> <item> <foo>x</foo> <bar>y</bar> <baz>z</baz> </item> </items>
Which matches the DTD with one small change:
<!ELEMENT bar (#PCDATA)> <!ELEMENT baz (#PCDATA)> <!ELEMENT foo (#PCDATA)> <!ELEMENT item (foo, bar, baz, item?)> <!ELEMENT items (item+)>

What's my HTML form going to look like when any given <item> element can contain an arbitrary number of other <item> elements?



Nobody says perl looks like line-noise any more
kids today don't know what line-noise IS ...

In reply to Re^3: Going between XML and Cgi by way of DTD by Cody Pendant
in thread Going between XML and CGi by way of DTD by throop

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.