[ZDP] The FAQ and the donkey

Martijn Pieters mj@antraciet.nl
Fri, 12 Mar 1999 11:58:36 +0100


At 20:02 11/03/99 , Pavlos Christoforou wrote:
>[warning: long]
>
Thanx for the warning... =)

[snip]
>   <maintainer>Martijn Faassen</maintainer>
>   <email>martijn@martijn.org</email>
[snip]
>    <maintainer>Martijn Pieters</maintainer>
>    <email>theothermartijn@martijn.org</email>
=)

>The <question_comment> and <answer_comment> look ugly
>but I believe they will rarely be used as shown
>above. The usual way to enter a comment or an answer is
>through the web interface, so contributors will not
>have to deal with all this verbosity.
>
><!ELEMENT section    (info?,entry+)>
><!ELEMENT entry      (question,answer?,(qcomment|acomment)*)>
><!ELEMENT question   (#PCDATA)>
><!ELEMENT answer     (#PCDATA)>  
><!ELEMENT qcomment   (#PCDATA)>
><!ELEMENT acomment   (#PCDATA)>

How about:
<!ELEMENT section    (info?,entry+)>
<!ELEMENT entry      (question,answer?)>
<!ELEMENT question   (#PCDATA|comment)*>
<!ELEMENT answer     (#PCDATA|comment)*>  
<!ELEMENT comment    (#PCDATA)>

and of course
<!ATTLIST comment 
    format CDATA "structured-text" 
    author CDATA #IMPLIED 
    email  CDATA #IMPLIED 
    date   CDATA #IMPLIED> 

A question or answer can then have 0 or more comments associated with it,
like so:
<question contributor='Jim' email='jim@jim.org'> 
How can you do this?
<comment>What a profound question<comment> 
</question>

Problem would be how to deal with whitespace (especially when sturctured
text is used). But when whitespace matters, we are usually using <![CDATA[
]]> anyway, so we can strip leading and trailing whitespace from any
Character Data contained in the question or answer. Or we could support the
xml:space special attribute (see http://www.w3.org/TR/REC-xml#sec-white-space).

If we're only supporting three formats, declare them explicitly, like so:
<!ATTLIST question 
    format (structured-text|html-quote|plain) "html-quote"
    author CDATA #IMPLIED 
    email  CDATA #IMPLIED 
    date   CDATA #IMPLIED>
for the 'question' tag. For 'answer' the default would be
"structured-text", etc.

For convenience, you could store the format options in a parsed entity, so
if we would support a new format, we would only have to add it in one
place, like so:
<!ENTITY % formats '(structured-text|html-quote|plain)'>

and then we refer to %formats;, like so:
<!ATTLIST question 
    format %formats "html-quote"
    author CDATA #IMPLIED 
    email  CDATA #IMPLIED 
    date   CDATA #IMPLIED>

The XML Parser used should be able to support it of course =).

Martijn Pieters <theothermartijn@martijn.org>


--
M.J. Pieters, Web Developer
| Antraciet http://www.antraciet.nl
| Tel: +31-35-6254545 Fax: +31-35-6254555
| mailto:mj@antraciet.nl http://www.antraciet.nl/~mj
| PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149
------------------------------------------