Page 1 of 1

DTD problem: '(' seems to be missing

Posted: Thu Sep 22, 2005 3:45 pm
by muewi
Hello,

I get the following error message when I validate the DTD:

SystemID: /home/muewi/Clark3/quellen/synAnnot_B11varFullVersion.dtd
Position: 15:1
Beschreibung: F A '(' character or an element type is required in the declaration of element type "apostille".

<!ELEMENT apostille ((#PCDATA | ref)+)>
<!ATTLIST apostille
id ID #IMPLIED
n CDATA #IMPLIED
>

Maybe I'm just too stupid - I just can't see what I did wrong here.

Thanks,
Frank

Posted: Thu Sep 22, 2005 4:23 pm
by george
Hi Frank,

DTDs are very restrictive with the use of PCDATA. You can use that only to specify elements that contain only text as in

<!ELEMENT x (#PCDATA)>

or to specify that an element can contain mixed content and in that case PCDATA must appear in a choice model with the elements that can be contained in that element and with a zero or more number of ocurances for the choice model, as in

<!ELEMENT x (#PCDATA|x|y|z)*>

In your case you can only do:

<!ELEMENT apostille (#PCDATA | ref)*>

If you need more consider XML Schema or Relax NG.

Best regards,
George

Posted: Thu Sep 22, 2005 7:19 pm
by muewi
Hi George,

thanks for your help!
Of course, I should have known that; I've read it several times. But the funny thing is: I exported the DTD containing this declaration from another XML-editor, where this DTD is valid. There are even other rules, like:

<!ELEMENT clauseCat ((#PCDATA),comment?,apostille?)>

and

<!ELEMENT div (head*,
(((#PCDATA|unclear_start|unclear_end|pb|pause|interject|poem|p|s|q)+,
((unclear_start|pb)?,(div,unclear_end?))*)|((unclear_start|pb)?,
(div,unclear_end?))+),comment?,apostille?)>

Best regards,
Frank