Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

DTD Question

16 views
Skip to first unread message

Ioannis Liabotis

unread,
Jan 14, 2000, 3:00:00 AM1/14/00
to
Hello everybody,

is it possible to declare a list of values for an element??

e.g.
<!ELEMENT month ( month_name)>
is it possible to restrict month name to one of JAN, FEB,...DEC??

Thank you in advance.
Giannis.


Lance Purple

unread,
Jan 14, 2000, 3:00:00 AM1/14/00
to
Ioannis Liabotis <i.lia...@ee.ucl.ac.uk> wrote:
>
>is it possible to declare a list of values for an element??
>e.g. <!ELEMENT month ( month_name)>
>is it possible to restrict month name to one of JAN, FEB,...DEC??

No, but you can declare the them as attribute values or empty tags,

<!ELEMENT month EMPTY>
<!ATTLIST month name ( JAN | FEB | MAR ... ) #required>

---> <month name="JAN"/>

Or

<!ELEMENT month ( JAN | FEB | MAR | APR ...) >
<!ELEMENT JAN EMPTY >
<!ELEMENT FEB EMPTY >
... etc.

---> <month><JAN/></month>

Hope that helps.

--
,--------------------------------------------,
| Lance Purple (lpurple at netcom dot com) |
'--------------------------------------------'

Joseph Kesselman (yclept Keshlam)

unread,
Jan 18, 2000, 3:00:00 AM1/18/00
to
Ioannis Liabotis wrote:
> <!ELEMENT month ( month_name)>
> is it possible to restrict month name to one of JAN, FEB,...DEC??

Not using DTDs. XML Schemas may add that capabiility. You
_can_ specify sets of legal values for attributes; I'd
suggest you go that route... or test for legal value in your
application code.

--
-----------------------------------------------------------------
Joe Kesselman, kes...@us.ibm.com

bob...@my-deja.com

unread,
Jan 19, 2000, 3:00:00 AM1/19/00
to
Schemas are definately the way to go but when is the W3 going to release
a solid specification for them? Until then it seems we'll never be able
to actually validate XML with a schema.
What is your take on this Mr. Kesselman?

In article <3884A27D...@us.ibm.com>,


Sent via Deja.com http://www.deja.com/
Before you buy.

Joseph Kesselman (yclept Keshlam)

unread,
Jan 19, 2000, 3:00:00 AM1/19/00
to
bob...@my-deja.com wrote:>
> Schemas are definately the way to go but when is the W3 going to release
> a solid specification for them?

I'm not on the Schema WG; I don't know any more about target
dates than the rest of you. I _have_ heard, informally, that
they've made a considerable amount of progress over the past
month in resolving some of the most contentious issues,
which is encouraging.

> Until then it seems we'll never be able
> to actually validate XML with a schema.

Not portably, anyway.

It's the same situation that XSLT has been in until recently
-- the spec was still evolving, so there weren't a lot of
folks willing to invest in pre-standard prototypes and those
prototypes didn't all agree with each other. You could use
them on an experimental basis inside your own shop, but it
was generally a bad idea to assume that the customer's
version would be compatable... or that they had a copy at
all. XSLT is settling down now; schemas will do likewise.

(I'm also hoping it's soon. We'd like to start writing
support for schemas into the DOM APIs...)

Ah, the joys of being on the leading edge of technology...
<smile/>

0 new messages