Hollenbeck, Scott wrote:

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-



Hi Scott,

haven't tried out, but maybe Xerces-J 1.4.3 interprets the last dash as the dash of a range, like the ones before, and gets a bit confused. Perhaps try to quote it.

[a-zA-Z0-9_-]{4,24}
           ^

regards,

Klaus Malorny


___________________________________________________________________________ | | | knipp | Knipp Medien und Kommunikation GmbH ------- Technologiepark Martin-Schmei�er-Weg 9 Dipl. Inf. Klaus Malorny 44227 Dortmund [EMAIL PROTECTED] Tel. +49 231 9703 0




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



Reply via email to