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.
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) |
'--------------------------------------------'
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
In article <3884A27D...@us.ibm.com>,
Sent via Deja.com http://www.deja.com/
Before you buy.
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/>