
Lee Passey wrote:
Marcello Perathoner wrote:
Lee Passey wrote:
On the other hand, I don't see how Mr. Hutchinson's second example could validate if the first does not, particularly given the fact that DTD's are not structured in such a way to permit a validator to make that kind of a judgment ("if a <div> contains a <div> it must be the last element of the first <div>" or "if a <div> contains a <div> it may be preceded by a <p>, but not followed by one").
This simple declaration does exactly that:
<!ELEMENT div (p*, div*)>
"A div may contain zero or more p followed by zero or more div."
Well, I carefully decomposed the TEI DTD and discovered that you're absolutely right (but you knew that already, didn't you :-)). As I understand it, a <div> can contain just about any other element, but once you include another <div> you can't include anything else (almost).
What the hell were they thinking?
Hmmm, when I parsed the full content model for TEI <div> (which I obtained from TEI Pizza Chef -- again a cool way to flatten the TEI P4X DTD), removing all elements except for <div> and <p> (let's assume that's all we're going to use in our little thought experiment here), I get for the content model: <!ELEMENT div (div+ | (p+, div*))> Compared to the one mentioned by Marcello, it is close to the same one, but not exactly the same -- i.e., we cannot have <div></div> -- <div> has to contain something. But other than this small difference it is otherwise logically the same, so Marcello's is easier to wrap our minds around.) Not sure, Lee, what you mean by your statement. What is interesting, as noted by Lee in a prior message (see above), that one may not have a <p> after a <div> within another <div>. I.e., this appears to be invalid TEI P4X: <div> <p>something</p> <div>...</div> <p>something else</p> </div> While this is valid: <div> <p>something</p> <p>something else</p> <div>...</div> </div> Last year I talked about Burton's Arabian Nights which structurally and logically follows, in many places, the p-div-p pattern, to several levels of nesting. So if I were to customize the TEI content model for <div>, I would seriously allow a <p> after a child <div>. I don't see a problem in doing this, but then I don't fully understand the quite subtle explanations offered on TEI-L regarding this (especially as it pertains to the Arabian Nights where stories are wrapped inside of stories to several levels of nesting.)
I don't see anything in the English spec that would have led me to this conclusion, and I can't think of any rationale why it should be this way. Is it possible that the DTD has incorrectly implemented the TEI spec? Or did the authors really intend this inane result? I have to admit, this requirement (and the fact that <div> is not allowed inside <p>) really makes me have second thoughts about the usefulness of TEI as an encoding (because it hinders you from making a level-one, incomplete, encoding).
I would really like to know what the rationale for this rule is.
I suggest that you repackage your inquiry and post it to TEI-L. That's where the bulk of the TEI experts, including those involved with TEI development, hang out. Sebastian Rahtz is one of the brilliant people there who is interested in a more constrained TEI subset for ebook use. http://www.lsoft.com/scripts/wl.exe?SL1=TEI-L&H=LISTSERV.BROWN.EDU Maybe this time around the TEI mavens will be able to cogently explain (at the highest abstract level) why one should not have a <p> after a <div> within another <div>, but can have a <p> before the <div>. I'm still quite perplexed, as it appears Marcello is as well. Jon