You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by "E. de Haan" <ed...@allshare.nl> on 2001/04/01 12:42:59 UTC

Re: Need help with DTD

----- Original Message -----
From: "callista" <ca...@simecity.com>
To: <xe...@xml.apache.org>
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: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


Re: Need help with DTD

Posted by "E. de Haan" <ed...@allshare.nl>.
try it.

implementation wise i dont see a problem,
all 'other' instances until the 'form' match
with the first 'other'. if there is no 'form',
the second 'other' must be empty...

----- Original Message -----
From: "Hilary Bannister" <hi...@cwcom.net>
To: "xerces user group" <xe...@xml.apache.org>
Sent: Tuesday, April 03, 2001 12:19 AM
Subject: Re: Need help with DTD


> Will this work as the solution:
>
> <!ELEMENT page (other*|form?|other*)>
>
> as it is non-deterministic and I am led to believe that every content
model
> must
> be deterministic.  Am I wrong?
>
>  <!ELEMENT page (other*|form|other*)>
>
> is deterministic because the form is required so you know which set the
> "other" instances belong to.  The above optional version cannot determine
> which set the "other" instances belong to if the form is missing.
>
>
>
> ----- Original Message -----
> From: E. de Haan <ed...@allshare.nl>
> To: <xe...@xml.apache.org>
> Sent: 01 April 2001 11:42
> Subject: Re: Need help with DTD
>
>
> > ----- Original Message -----
> > From: "callista" <ca...@simecity.com>
> > To: <xe...@xml.apache.org>
> > 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: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


Re: Need help with DTD

Posted by Hilary Bannister <hi...@cwcom.net>.
Will this work as the solution:

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

as it is non-deterministic and I am led to believe that every content model
must
be deterministic.  Am I wrong?

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

is deterministic because the form is required so you know which set the
"other" instances belong to.  The above optional version cannot determine
which set the "other" instances belong to if the form is missing.



----- Original Message -----
From: E. de Haan <ed...@allshare.nl>
To: <xe...@xml.apache.org>
Sent: 01 April 2001 11:42
Subject: Re: Need help with DTD


> ----- Original Message -----
> From: "callista" <ca...@simecity.com>
> To: <xe...@xml.apache.org>
> 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: xerces-j-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-user-help@xml.apache.org
>



---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org