You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by "Jeroen N. Witmond" <jn...@xs4all.nl> on 2004/05/05 20:25:35 UTC

Re: Problem with validating string pattern, which uses regular expression

> The pattern value contains an invalid character [A-Za-z0-9_-]. You should
> use '\-' instead.

XML Schema Part 2: Datatypes: F Regular Expressions
http://www.w3.org/TR/xmlschema-2/#dt-regex contains the following: "A
single XML character is a ·character range· that identifies the set of
characters containing only itself. All XML characters are valid character
ranges, except as follows: [...] The - character is a valid character
range only at the beginning or end of a ·positive character group·."

This seems to indicate that the pattern is valid, and contains upper and
lower case characters, digits, the underscore and the dash. This would be
consistent with other implementations of regular expressions.

Please correct me if I'm wrong.

Regards,

Jeroen.

>                                                            ^
>
> Khaled
>
>
>
>
>
>              Dimitar Hristozov
>              <Dimitar.Hristozo
>              v@chemie.uni-erla                                          To
>              ngen.de>                  xerces-c-dev@xml.apache.org
>                                                                         cc
>              05/05/2004 05:51
>              AM                                                    Subject
>                                        Problem with validating string
>                                        pattern, which uses regular
>              Please respond to         expression
>                xerces-c-dev
>
>
>
>
>
>
>
>
>
> Dear all,
>
> I experienced the following problem with xerces-c-2_5_0 under SuSE Linux
> 9.0:
>
> When trying to validate the attached CML ( Chemical Markup Language ) file
> against the schema, both SAX2Print and DOMPrint report the following
> error:
>
> Error at file "/home/dimitarh/cml/cml_try12.xml", line 4, column 89
> Message: Datatype error: Type:InvalidDatatypeValueException, Message:'-'
> is
>
> not a valid character range; use '\-' instead.
>
> I went through the mailing list archives and through the API, but found
> nothing about this issue, so I will appreciate any help/comments.
>
> The idType definition in the CML schema is the following ( full schemas
> available at http://cml.sourceforge.net/ ):
>
>   <xsd:simpleType name="idType" id="st.idType">
>   <xsd:annotation>
>     <xsd:documentation>
>              <!-- ommited -->
>       </xsd:documentation>
>      </xsd:annotation>
>    <xsd:restriction base="xsd:string">
>      <xsd:pattern value="([A-Za-z][A-Za-z0-9_-]*:)?[A-Za-z]
> [A-Za-z0-9_\-\.]*"/>
>    </xsd:restriction>
> </xsd:simpleType>
>
> When I remove all ids from the attached file, the validation is OK.
> Any ideas are welcome,
>
> thanks for your help,
> kind regards,
> Dimitar Hristozov
>
>
>
>
> [attachment "cml_try12.xml" deleted by Khaled Noaman/Toronto/IBM]
> ---------------------------------------------------------------------
> To
> unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


Re: Problem with validating string pattern, which uses regular expression

Posted by Khaled Noaman <kn...@ca.ibm.com>.



According the schema errata [1], the '-' is no longer a valid character
range.

Khaled

[1] http://www.w3.org/2001/05/xmlschema-errata.html#e2-18




                                                                           
             "Jeroen N.                                                    
             Witmond"                                                      
             <jn...@xs4all.nl>                                            To 
                                       xerces-c-dev@xml.apache.org         
             05/05/2004 02:25                                           cc 
             PM                                                            
                                                                   Subject 
                                       Re: Problem with validating string  
             Please respond to         pattern,      which uses regular    
               xerces-c-dev            expression                          
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           




> The pattern value contains an invalid character [A-Za-z0-9_-]. You should
> use '\-' instead.

XML Schema Part 2: Datatypes: F Regular Expressions
http://www.w3.org/TR/xmlschema-2/#dt-regex contains the following: "A
single XML character is a ·character range· that identifies the set of
characters containing only itself. All XML characters are valid character
ranges, except as follows: [...] The - character is a valid character
range only at the beginning or end of a ·positive character group·."

This seems to indicate that the pattern is valid, and contains upper and
lower case characters, digits, the underscore and the dash. This would be
consistent with other implementations of regular expressions.

Please correct me if I'm wrong.

Regards,

Jeroen.

>                                                            ^
>
> Khaled
>
>
>
>
>
>              Dimitar Hristozov
>              <Dimitar.Hristozo
>              v@chemie.uni-erla
To
>              ngen.de>                  xerces-c-dev@xml.apache.org
>
cc
>              05/05/2004 05:51
>              AM
Subject
>                                        Problem with validating string
>                                        pattern, which uses regular
>              Please respond to         expression
>                xerces-c-dev
>
>
>
>
>
>
>
>
>
> Dear all,
>
> I experienced the following problem with xerces-c-2_5_0 under SuSE Linux
> 9.0:
>
> When trying to validate the attached CML ( Chemical Markup Language )
file
> against the schema, both SAX2Print and DOMPrint report the following
> error:
>
> Error at file "/home/dimitarh/cml/cml_try12.xml", line 4, column 89
> Message: Datatype error: Type:InvalidDatatypeValueException, Message:'-'
> is
>
> not a valid character range; use '\-' instead.
>
> I went through the mailing list archives and through the API, but found
> nothing about this issue, so I will appreciate any help/comments.
>
> The idType definition in the CML schema is the following ( full schemas
> available at http://cml.sourceforge.net/ ):
>
>   <xsd:simpleType name="idType" id="st.idType">
>   <xsd:annotation>
>     <xsd:documentation>
>              <!-- ommited -->
>       </xsd:documentation>
>      </xsd:annotation>
>    <xsd:restriction base="xsd:string">
>      <xsd:pattern value="([A-Za-z][A-Za-z0-9_-]*:)?[A-Za-z]
> [A-Za-z0-9_\-\.]*"/>
>    </xsd:restriction>
> </xsd:simpleType>
>
> When I remove all ids from the attached file, the validation is OK.
> Any ideas are welcome,
>
> thanks for your help,
> kind regards,
> Dimitar Hristozov
>
>
>
>
> [attachment "cml_try12.xml" deleted by Khaled Noaman/Toronto/IBM]
> ---------------------------------------------------------------------
> To
> unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org