DTD problem: '(' seems to be missing

This should cover W3C XML Schema, Relax NG and DTD related problems.
muewi
Posts: 26
Joined: Wed Aug 24, 2005 10:47 am

DTD problem: '(' seems to be missing

Post by muewi » Thu Sep 22, 2005 3:45 pm

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

george
Site Admin
Posts: 2101
Joined: Thu Jan 09, 2003 2:58 pm

Post by george » Thu Sep 22, 2005 4:23 pm

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

muewi
Posts: 26
Joined: Wed Aug 24, 2005 10:47 am

Post by muewi » Thu Sep 22, 2005 7:19 pm

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

Post Reply