----- Original Message -----
From: "callista" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, April 02, 2001 9:53 AM
Subject: Need help with DTD

> Hi, I'm having problem creating a DTD to do what I need it to do.
>
> Here's what I need.
> Page element can have one/zero form element or zero/many other element.
>
> Examples:
> One:
> <page>
>   <other></other>
>   <other></other>
>   <form></form>
>   <other></other>
> </page>
>
> Two:
> <page></page>
>
> Three:
> <page>
>   <other></other>
>   <other></other>
> </page>
>
> Four:
> <page>
>   <form></form>
> </page>
>
> All the above should be valid. As long as there is more than one <form>
> tag, it's invalid.
> i.e: <page>
>        <form></form>
>        <form></form>
>      </page>
> Should generate a ParseError. If possible, I would like the example below
> to generate an error as well.
> <page>
>   <other>
>     <form></form>
>   </other>
>   <form></form>
> </page>
>
> I was going along the line of <!ELEMENT page (form?|other*)> but only
> examples 2 - 3 will be valid and not example 1. If I write it as <!ELEMENT
> page (form?|other*)*>, it's valid for examples 1-4 but it is also valid
for
> the invalid multiple <form> tag example.
>
> Can anyone help?  Callista
> ---------------------------------------------------------------------

In my opinion example 1 should be invalid,

<!ELEMENT page (form?|other*)>

but you can achieve what you want using:

<!ELEMENT page (other*|form?|other*)>

i think you missed this for exactly the reason
i think it should not be used.

Eric.



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to