Max and min values in DTD

M

Mithil

HI all,

Could anyone plz tell me whether max and min values can be specified
in DTD for an attirbute ? if not is there any way around it ? any help
and suggestion is greatly appreciated.

Regards,
Mithil
 
R

Richard Tobin

Mithil said:
Could anyone plz tell me whether max and min values can be specified
in DTD for an attirbute ? if not is there any way around it ?

No, it can't be done. DTDs don't provide any way to specify numeric
ranges. (Unless your range is something small like 1-5, in which case
you could possibly list all the legal values.)

The workaround is to use a different schema language, or check the
value in your application.

-- Richard
 
M

Martin Honnen

Mithil said:
Could anyone plz tell me whether max and min values can be specified
in DTD for an attirbute ? if not is there any way around it ? any help
and suggestion is greatly appreciated.

A DTD does not allow that. The W3C XML schema language however allows it
using the min/maxInclusive or min/maxExclusive facets:
http://www.w3.org/TR/xmlschema-2/#rf-facets
 
T

The Magpie

Mithil said:
HI all,

Could anyone plz tell me whether max and min values can be specified
in DTD for an attirbute ? if not is there any way around it ? any help
and suggestion is greatly appreciated.
Don't think you can do that in a DTD, though you can in a Schema.
 
J

Joseph Kesselman

Which is one of many reasons to consider moving to schemas.

But remember, DTDs *or* schemas are only an initial sanity-check stage
-- "higher-order syntax". It's always assumed that the application is
going to have to enforce semantic constraints.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
474,008
Messages
2,570,270
Members
46,873
Latest member
HeidiWeing

Latest Threads

Top