Max and min values in DTD

Discussion in 'XML' started by Mithil, Aug 27, 2007.

  1. Mithil

    Mithil Guest

    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
     
    Mithil, Aug 27, 2007
    #1
    1. Advertising

  2. In article <>,
    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.
     
    Richard Tobin, Aug 27, 2007
    #2
    1. Advertising

  3. 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/
     
    Martin Honnen, Aug 27, 2007
    #3
  4. Mithil

    Mithil Guest

    Thanks Martin and Richard
     
    Mithil, Aug 27, 2007
    #4
  5. Mithil

    The Magpie Guest

    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.
     
    The Magpie, Aug 28, 2007
    #5
  6. 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
     
    Joseph Kesselman, Aug 28, 2007
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Lois
    Replies:
    1
    Views:
    3,259
    Ryan Stewart
    Dec 27, 2004
  2. Vijai Kalyan
    Replies:
    1
    Views:
    314
    Howard Hinnant
    Mar 21, 2006
  3. Gary Wessle

    min and max running values

    Gary Wessle, Mar 5, 2007, in forum: C++
    Replies:
    41
    Views:
    1,060
    Pete Becker
    Mar 7, 2007
  4. John [H2O]
    Replies:
    0
    Views:
    691
    John [H2O]
    Jul 7, 2011
  5. Dennis Lee Bieber
    Replies:
    0
    Views:
    596
    Dennis Lee Bieber
    Jul 7, 2011
Loading...

Share This Page