I have a simpleType declaration that looks like this:

  <simpleType name="fooType">
    <restriction base="token">
      <pattern value="[a-zA-Z0-9_-]{4,24}"/>
    </restriction>
  </simpleType>

I want to accept values containing a minimum of 4 and a maximum of 24
characters in the set {a-z|A-Z|0-9|_|-}.  Xerces-J 1.4.3 and 1.4.4 do not
reject element values that contain more than 24 of the allowable characters.
They do reject elements that contain less than 4 characters, though.  This
element gets rejected:

<foo>abc</foo>
(error:  "does not match regular expression facet '[a-zA-Z0-9_-]{4,24}'")

This one doesn't:

<foo>abc-123_AB1111111111111111111</foo>

Is the error in my pattern, or is Xerces-J doing something wrong?  I can
make this work by putting a maxLength facet inside the <restriction>, but I
don't see why that should be necessary.

FWIW Xerces-J 2.0.0 beta 3 catches the error:

"[Error] test.xml:15:83: cvc-type.3.1.3: The value
'abc-123_AB1111111111111111111' of element 'foo' is not valid."

-Scott- 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to