Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Max and min values in DTD

Reply
Thread Tools

Max and min values in DTD

 
 
Mithil
Guest
Posts: n/a
 
      08-27-2007
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

 
Reply With Quote
 
 
 
 
Richard Tobin
Guest
Posts: n/a
 
      08-27-2007
In article < .com>,
Mithil <> wrote:

>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
--
"Consideration shall be given to the need for as many as 32 characters
in some alphabets" - X3.4, 1963.
 
Reply With Quote
 
 
 
 
Martin Honnen
Guest
Posts: n/a
 
      08-27-2007
Mithil wrote:

> 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


--

Martin Honnen
http://JavaScript.FAQTs.com/
 
Reply With Quote
 
Mithil
Guest
Posts: n/a
 
      08-27-2007
Thanks Martin and Richard

 
Reply With Quote
 
The Magpie
Guest
Posts: n/a
 
      08-28-2007
Mithil wrote:
> 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.
 
Reply With Quote
 
Joseph Kesselman
Guest
Posts: n/a
 
      08-28-2007
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.

--
Joe Kesselman / Beware the fury of a patient man. -- John Dryden
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: find max and min values from a column of a csv file Dennis Lee Bieber Python 0 07-07-2011 05:18 PM
Re: find max and min values from a column of a csv file John [H2O] Python 0 07-07-2011 10:38 AM
min and max running values Gary Wessle C++ 41 03-07-2007 07:23 PM
Why are the min and max values for a particular numeric type implemented as functions? Vijai Kalyan C++ 1 03-21-2006 02:39 PM
CSS min-width, max-width, and min-height with display:inline Lois HTML 1 12-27-2004 03:03 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57