XSD - what's a difference ?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Matthet

    #1

    XSD - what's a difference ?

    Hi,

    Is there any difference if I write sth like this:

    <xsd:simpleTy pe name="Name">
    <xsd:restrictio n base="xsd:strin g">
    <xsd:minLengt h value="1">
    <xsd:maxLengt h value="10">
    </xsd:restriction >
    </xsd:simpleType>

    and this:

    <xsd:simpleTy pe name="Name">
    <xsd:restrictio n base="xsd:strin g">
    <xsd:pattern value=".{1,10}" >
    </xsd:restriction >
    </xsd:simpleType>

    Thx for any help
    MAciek


  • Martin Boehm

    #2
    Re: XSD - what's a difference ?

    "Matthet" <matthet@polbox .com> wrote in message
    news:bknd6f$1ad $1@foka1.acn.pl
    [color=blue]
    > Is there any difference if I write sth like this:
    >
    > [xsd:string restricted by minLength and maxLength]
    >
    > and this:
    >
    > [xsd:string restricted by regex pattern][/color]

    The effect of both restrictions is that you must have a string with at
    least one and at most 10 characters. The only difference may be in
    execution speed. Determinig the length of a string is faster than
    matching it against a regular expression, be it as simple as it may.

    If all you want to do is restricting string-length, you should stick
    with minLenth and maxLength.

    Martin


    Comment

    • Matthet

      #3
      Re: XSD - what's a difference ?

      "Martin Boehm" wrote[color=blue]
      >
      > If all you want to do is restricting string-length, you should stick
      > with minLenth and maxLength.
      >[/color]

      Thanks
      I thought so but I wasn't sure.
      I needed some expert opinion.

      MAciek


      Comment

      • C. M. Sperberg-McQueen

        #4
        Re: XSD - what's a difference ?

        "Matthet" <matthet@polbox .com> writes:
        [color=blue]
        > Is there any difference if I write sth like this:
        >
        > <xsd:simpleTy pe name="Name">
        > <xsd:restrictio n base="xsd:strin g">
        > <xsd:minLengt h value="1">
        > <xsd:maxLengt h value="10">
        > </xsd:restriction >
        > </xsd:simpleType>
        >
        > and this:
        >
        > <xsd:simpleTy pe name="Name">
        > <xsd:restrictio n base="xsd:strin g">
        > <xsd:pattern value=".{1,10}" >
        > </xsd:restriction >
        > </xsd:simpleType>[/color]

        The first matches any string with at least one and at most
        ten characters. Since '.' is defined as matching any character
        except linefeed or carriage return, the second matches the same
        set of strings, minus those which contain a linefeed or carriage
        return as one of their characters; it is equivalent to
        "[^\n\r]{1,10}".

        I hope this helps.

        -C. M. Sperberg-McQueen
        World Wide Web Consoritium

        Comment

        Working...