You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by "T. Allen" <bi...@verizon.net> on 2014/02/10 18:40:04 UTC

Regex problems with XMLBeans

I have an Axis2 1.6.1 web service that has 1 regex in the WSDL schema.  
The WSDL/schema snippet is below.

<xsd:complexType name="hazmat">
<xsd:sequence>
<xsd:element minOccurs="0" name="hazmatCode" nillable="true" 
type="tns:hazmatCode"/>
<xsd:element minOccurs="0" name="hazmatFlag" nillable="true" 
type="tns:hazmatFlag"/>
</xsd:sequence>
</xsd:complexType>
<xsd:simpleType name="hazmatCode">
<xsd:restriction base="xsd:string">
<xsd:whiteSpace value="preserve"/>
<xsd:pattern value="^(NA|UN).*"/>
</xsd:restriction>
</xsd:simpleType>

I know the regex pattern of ^(NA|UN).* is valid as I have tested it.  
However, each time I send a request with a string that matches the 
pattern I get an error like "string value 'NA1122' does not match 
pattern" when performing validation against the schema.

I have used simple patterns before with XMLBeans and they have worked 
fine.  Have I defined the regex incorrectly or does the XMLBeans binding 
have problems with regex?

Any and all information is appreciated.

Thanks,
T


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org


Re: Regex problems with XMLBeans

Posted by "T. Allen" <bi...@verizon.net>.
Has anyone had problems with regex using XML Beans binding (see message 
below)?  I have used the following regex and it worked fine:
<xsd:pattern value="\d{10}|\d{3}\-d{7}" />

This regex gives an error every time:
<xsd:pattern value="^(NA|UN).*"/>

Have I done something wrong or is this a bug with XML Beans?

Thanks,
T


On 2/10/2014 12:40 PM, T. Allen wrote:
> I have an Axis2 1.6.1 web service that has 1 regex in the WSDL 
> schema.  The WSDL/schema snippet is below.
>
> <xsd:complexType name="hazmat">
> <xsd:sequence>
> <xsd:element minOccurs="0" name="hazmatCode" nillable="true" 
> type="tns:hazmatCode"/>
> <xsd:element minOccurs="0" name="hazmatFlag" nillable="true" 
> type="tns:hazmatFlag"/>
> </xsd:sequence>
> </xsd:complexType>
> <xsd:simpleType name="hazmatCode">
> <xsd:restriction base="xsd:string">
> <xsd:whiteSpace value="preserve"/>
> <xsd:pattern value="^(NA|UN).*"/>
> </xsd:restriction>
> </xsd:simpleType>
>
> I know the regex pattern of ^(NA|UN).* is valid as I have tested it.  
> However, each time I send a request with a string that matches the 
> pattern I get an error like "string value 'NA1122' does not match 
> pattern" when performing validation against the schema.
>
> I have used simple patterns before with XMLBeans and they have worked 
> fine.  Have I defined the regex incorrectly or does the XMLBeans 
> binding have problems with regex?
>
> Any and all information is appreciated.
>
> Thanks,
> T
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-dev-help@axis.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org


RE: Regex problems with XMLBeans

Posted by Martin Gainty <mg...@hotmail.com>.
<xsd:pattern value="^(NA|UN).*"/>
NOT NA OR NOT UN with any extension is not


<xsd:pattern value="(NA|UN).*"/>

NAOR UN with any extension

 

this is incorrect behaviour

 

https://issues.apache.org/jira/i#browse/AXIS-2899

Feel free to add comments..
Obrigado Roberto
Martin-







> Date: Fri, 14 Feb 2014 21:34:57 -0200
> Subject: Re: Regex problems with XMLBeans
> From: robertlazarski@gmail.com
> To: java-dev@axis.apache.org
> CC: java-user@axis.apache.org
> 
> On Fri, Feb 14, 2014 at 8:14 PM, T. Allen <bi...@verizon.net> wrote:
> > I did not receive any replies about this problem but was able to get past
> > it. Changing the regex from:
> > <xsd:pattern value="^(NA|UN).*"/>
> >
> > to:
> > <xsd:pattern value="(NA|UN).*"/>
> >
> > fixed the problem. It seems XML Beans does not interpret the leading ^
> > symbol correctly. Is this by design or should I create a JIRA?
> >
> > Thanks,
> > T
> >
> 
> Glad to you found the problem. While I have used xmlbeans with axis2,
> I never used regex like that with it and didn't have any advice.
> 
> Looking here though indicates that this is by design:
> 
> http://www.w3.org/TR/xmlschema-0/#regexAppendix
> 
> "the expression language does not contain the metacharacters ^ and $,
> although ^ is used to express exception, e.g. [^0-9]x" .
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-user-help@axis.apache.org
> 
 		 	   		  

Re: Regex problems with XMLBeans

Posted by "T. Allen" <bi...@verizon.net>.
Robert,

Thanks very much for this information.

T


On 2/14/2014 6:34 PM, robertlazarski . wrote:
> On Fri, Feb 14, 2014 at 8:14 PM, T. Allen<bi...@verizon.net>  wrote:
>> I did not receive any replies about this problem but was able to get past
>> it.  Changing the regex from:
>> <xsd:pattern value="^(NA|UN).*"/>
>>
>> to:
>> <xsd:pattern value="(NA|UN).*"/>
>>
>> fixed the problem.  It seems XML Beans does not interpret the leading ^
>> symbol correctly.  Is this by design or should I create a JIRA?
>>
>> Thanks,
>> T
>>
> Glad to you found the problem. While I have used xmlbeans with axis2,
> I never used regex like that with it and didn't have any advice.
>
> Looking here though indicates that this is by design:
>
> http://www.w3.org/TR/xmlschema-0/#regexAppendix
>
> "the expression language does not contain the metacharacters ^ and $,
> although ^ is used to express exception, e.g. [^0-9]x" .
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-user-help@axis.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org


Re: Regex problems with XMLBeans

Posted by "T. Allen" <bi...@verizon.net>.
Robert,

Thanks very much for this information.

T


On 2/14/2014 6:34 PM, robertlazarski . wrote:
> On Fri, Feb 14, 2014 at 8:14 PM, T. Allen<bi...@verizon.net>  wrote:
>> I did not receive any replies about this problem but was able to get past
>> it.  Changing the regex from:
>> <xsd:pattern value="^(NA|UN).*"/>
>>
>> to:
>> <xsd:pattern value="(NA|UN).*"/>
>>
>> fixed the problem.  It seems XML Beans does not interpret the leading ^
>> symbol correctly.  Is this by design or should I create a JIRA?
>>
>> Thanks,
>> T
>>
> Glad to you found the problem. While I have used xmlbeans with axis2,
> I never used regex like that with it and didn't have any advice.
>
> Looking here though indicates that this is by design:
>
> http://www.w3.org/TR/xmlschema-0/#regexAppendix
>
> "the expression language does not contain the metacharacters ^ and $,
> although ^ is used to express exception, e.g. [^0-9]x" .
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-user-help@axis.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org


Re: Regex problems with XMLBeans

Posted by "robertlazarski ." <ro...@gmail.com>.
On Fri, Feb 14, 2014 at 8:14 PM, T. Allen <bi...@verizon.net> wrote:
> I did not receive any replies about this problem but was able to get past
> it.  Changing the regex from:
> <xsd:pattern value="^(NA|UN).*"/>
>
> to:
> <xsd:pattern value="(NA|UN).*"/>
>
> fixed the problem.  It seems XML Beans does not interpret the leading ^
> symbol correctly.  Is this by design or should I create a JIRA?
>
> Thanks,
> T
>

Glad to you found the problem. While I have used xmlbeans with axis2,
I never used regex like that with it and didn't have any advice.

Looking here though indicates that this is by design:

http://www.w3.org/TR/xmlschema-0/#regexAppendix

"the expression language does not contain the metacharacters ^ and $,
although ^ is used to express exception, e.g. [^0-9]x" .

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org


Re: Regex problems with XMLBeans

Posted by "robertlazarski ." <ro...@gmail.com>.
On Fri, Feb 14, 2014 at 8:14 PM, T. Allen <bi...@verizon.net> wrote:
> I did not receive any replies about this problem but was able to get past
> it.  Changing the regex from:
> <xsd:pattern value="^(NA|UN).*"/>
>
> to:
> <xsd:pattern value="(NA|UN).*"/>
>
> fixed the problem.  It seems XML Beans does not interpret the leading ^
> symbol correctly.  Is this by design or should I create a JIRA?
>
> Thanks,
> T
>

Glad to you found the problem. While I have used xmlbeans with axis2,
I never used regex like that with it and didn't have any advice.

Looking here though indicates that this is by design:

http://www.w3.org/TR/xmlschema-0/#regexAppendix

"the expression language does not contain the metacharacters ^ and $,
although ^ is used to express exception, e.g. [^0-9]x" .

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org


Re: Regex problems with XMLBeans

Posted by "T. Allen" <bi...@verizon.net>.
I did not receive any replies about this problem but was able to get 
past it.  Changing the regex from:
<xsd:pattern value="^(NA|UN).*"/>

to:
<xsd:pattern value="(NA|UN).*"/>

fixed the problem.  It seems XML Beans does not interpret the leading ^ 
symbol correctly.  Is this by design or should I create a JIRA?

Thanks,
T


On 2/12/2014 9:01 AM, T. Allen wrote:
> Has anyone else had problems with regex using XML Beans binding?  See 
> original message below.  I have used the following regex with XML 
> Beans and it worked fine:
> <xsd:pattern value="\d{10}|\d{3}\-d{7}" />
>
> This regex gives an error every time:
> <xsd:pattern value="^(NA|UN).*"/>
>
> When validating this regex with XML Beans binding I get "string value 
> does not match pattern" error.  Have I done something wrong or is this 
> a bug with XML Beans?
>
> Thanks,
> T
>
>
> On 2/10/2014 12:40 PM, T. Allen wrote:
>> I have an Axis2 1.6.1 web service that has 1 regex in the WSDL 
>> schema.  The WSDL/schema snippet is below.
>>
>> <xsd:complexType name="hazmat">
>> <xsd:sequence>
>> <xsd:element minOccurs="0" name="hazmatCode" nillable="true" 
>> type="tns:hazmatCode"/>
>> <xsd:element minOccurs="0" name="hazmatFlag" nillable="true" 
>> type="tns:hazmatFlag"/>
>> </xsd:sequence>
>> </xsd:complexType>
>> <xsd:simpleType name="hazmatCode">
>> <xsd:restriction base="xsd:string">
>> <xsd:whiteSpace value="preserve"/>
>> <xsd:pattern value="^(NA|UN).*"/>
>> </xsd:restriction>
>> </xsd:simpleType>
>>
>> I know the regex pattern of ^(NA|UN).* is valid as I have tested it.  
>> However, each time I send a request with a string that matches the 
>> pattern I get an error like "string value 'NA1122' does not match 
>> pattern" when performing validation against the schema.
>>
>> I have used simple patterns before with XMLBeans and they have worked 
>> fine.  Have I defined the regex incorrectly or does the XMLBeans 
>> binding have problems with regex?
>>
>> Any and all information is appreciated.
>>
>> Thanks,
>> T
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
>> For additional commands, e-mail: java-dev-help@axis.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-user-help@axis.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org


Re: Regex problems with XMLBeans

Posted by "T. Allen" <bi...@verizon.net>.
I did not receive any replies about this problem but was able to get 
past it.  Changing the regex from:
<xsd:pattern value="^(NA|UN).*"/>

to:
<xsd:pattern value="(NA|UN).*"/>

fixed the problem.  It seems XML Beans does not interpret the leading ^ 
symbol correctly.  Is this by design or should I create a JIRA?

Thanks,
T


On 2/12/2014 9:01 AM, T. Allen wrote:
> Has anyone else had problems with regex using XML Beans binding?  See 
> original message below.  I have used the following regex with XML 
> Beans and it worked fine:
> <xsd:pattern value="\d{10}|\d{3}\-d{7}" />
>
> This regex gives an error every time:
> <xsd:pattern value="^(NA|UN).*"/>
>
> When validating this regex with XML Beans binding I get "string value 
> does not match pattern" error.  Have I done something wrong or is this 
> a bug with XML Beans?
>
> Thanks,
> T
>
>
> On 2/10/2014 12:40 PM, T. Allen wrote:
>> I have an Axis2 1.6.1 web service that has 1 regex in the WSDL 
>> schema.  The WSDL/schema snippet is below.
>>
>> <xsd:complexType name="hazmat">
>> <xsd:sequence>
>> <xsd:element minOccurs="0" name="hazmatCode" nillable="true" 
>> type="tns:hazmatCode"/>
>> <xsd:element minOccurs="0" name="hazmatFlag" nillable="true" 
>> type="tns:hazmatFlag"/>
>> </xsd:sequence>
>> </xsd:complexType>
>> <xsd:simpleType name="hazmatCode">
>> <xsd:restriction base="xsd:string">
>> <xsd:whiteSpace value="preserve"/>
>> <xsd:pattern value="^(NA|UN).*"/>
>> </xsd:restriction>
>> </xsd:simpleType>
>>
>> I know the regex pattern of ^(NA|UN).* is valid as I have tested it.  
>> However, each time I send a request with a string that matches the 
>> pattern I get an error like "string value 'NA1122' does not match 
>> pattern" when performing validation against the schema.
>>
>> I have used simple patterns before with XMLBeans and they have worked 
>> fine.  Have I defined the regex incorrectly or does the XMLBeans 
>> binding have problems with regex?
>>
>> Any and all information is appreciated.
>>
>> Thanks,
>> T
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
>> For additional commands, e-mail: java-dev-help@axis.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-user-help@axis.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org


Re: Regex problems with XMLBeans

Posted by "T. Allen" <bi...@verizon.net>.
Has anyone else had problems with regex using XML Beans binding?  See 
original message below.  I have used the following regex with XML Beans 
and it worked fine:
<xsd:pattern value="\d{10}|\d{3}\-d{7}" />

This regex gives an error every time:
<xsd:pattern value="^(NA|UN).*"/>

When validating this regex with XML Beans binding I get "string value 
does not match pattern" error.  Have I done something wrong or is this a 
bug with XML Beans?

Thanks,
T


On 2/10/2014 12:40 PM, T. Allen wrote:
> I have an Axis2 1.6.1 web service that has 1 regex in the WSDL 
> schema.  The WSDL/schema snippet is below.
>
> <xsd:complexType name="hazmat">
> <xsd:sequence>
> <xsd:element minOccurs="0" name="hazmatCode" nillable="true" 
> type="tns:hazmatCode"/>
> <xsd:element minOccurs="0" name="hazmatFlag" nillable="true" 
> type="tns:hazmatFlag"/>
> </xsd:sequence>
> </xsd:complexType>
> <xsd:simpleType name="hazmatCode">
> <xsd:restriction base="xsd:string">
> <xsd:whiteSpace value="preserve"/>
> <xsd:pattern value="^(NA|UN).*"/>
> </xsd:restriction>
> </xsd:simpleType>
>
> I know the regex pattern of ^(NA|UN).* is valid as I have tested it.  
> However, each time I send a request with a string that matches the 
> pattern I get an error like "string value 'NA1122' does not match 
> pattern" when performing validation against the schema.
>
> I have used simple patterns before with XMLBeans and they have worked 
> fine.  Have I defined the regex incorrectly or does the XMLBeans 
> binding have problems with regex?
>
> Any and all information is appreciated.
>
> Thanks,
> T
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-dev-help@axis.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org