You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jaxme-dev@ws.apache.org by "Huang, Sheng (FSH)" <SH...@gov.mb.ca> on 2006/12/29 17:40:28 UTC

Question about pattern/enumeration constraint from Sheng

Good morning,

 

I am trying JAXME 0.5.2 and I can run some examples as well as create
some simple programs.

 

However, I have problem with creating a constraint to only allow integer
5 and 8 as the status. It seems that pattern and enumeration are not
working.

      <xsd:simpleType name="StatusType">

            <xsd:restriction base="xsd:positiveInteger">

               <xsd:pattern value="5|8"/>

            </xsd:restriction>

      </xsd:simpleType>

 

In generated Impl class, I cannot find code to check whether status is 5
or 8, and throw exception otherwise. I run the program and no error is
thrown for other values. But constraint like 

                              <xsd:restriction base="xsd:string">

                                    <xsd:maxLength value="50" />

                              </xsd:restriction>

work well and I can find the code in corresponding Impl class to check
length.

 

Would you please give me a hint about what I am wrong or whether those
features are supported? Thank you very much for your help.

 

Have a good day.

 

Best regards,

Sheng


RE: Question about pattern/enumeration constraint from Sheng (2)

Posted by "Huang, Sheng (FSH)" <Sh...@gov.mb.ca>.
Thanks to https://savannah.cern.ch/task/?2721, By referencing
src/test/jaxb/enumeration.xsd and add
		<xsd:annotation>
		  <xsd:appinfo>
			<jaxb:typesafeEnumClass name="StatusTypeClass">
			  <jaxb:typesafeEnumMember name="ABC"
value="5"/>
			  <jaxb:typesafeEnumMember name="CDE"
value="8"/>
			</jaxb:typesafeEnumClass>
		  </xsd:appinfo>
		</xsd:annotation>

I solved my problem and the enumeration works for us.

Regards,
Sheng


-----Original Message-----
From: Huang, Sheng (FSH) 
Sent: Friday, December 29, 2006 11:35 AM
To: Robert Eric Reeves
Cc: jaxme-dev@ws.apache.org
Subject: RE: Question about pattern/enumeration constraint from Sheng

Good morning Rob,

Thanks a lot for the quick reply again. Actually I have also tried
xsd:string but the same problem persists.

I have attached segments of my XSD and build script as follows so that
Jochen can have more clues about what might cause the problem. Thank you
very much for your help.

Have a happy new year!

Best regards,
Sheng

************************************************************************
*
A section of my XSD is as follows:
<?xml version="1.0" encoding="UTF-8"?>

<xsd:schema targetNamespace="http://www.gov.mb.ca/mstest"
			xmlns:xsd="http://www.w3.org/2001/XMLSchema"
			xmlns:mstest="http://www.gov.mb.ca/mstest"
			xml:lang="EN"
			elementFormDefault="qualified"
			attributeFormDefault="unqualified">

	<xsd:element name="application" type="mstest:ApplicationType" />
	<xsd:complexType name="ApplicationType">
		<xsd:sequence>
			<xsd:element name="applicationId"
type="xsd:positiveInteger" minOccurs="1" maxOccurs="1" />
			<xsd:element name="applicationStatus"
minOccurs="1" maxOccurs="1" type="mstest:StatusType">
			</xsd:element>
			<xsd:element name="remarks" minOccurs="1"
maxOccurs="1">
				<xsd:simpleType>
					<xsd:restriction
base="xsd:string">
						<xsd:maxLength
value="50" />
					</xsd:restriction>
				</xsd:simpleType>
			</xsd:element>
		</xsd:sequence>
		<xsd:attribute name="id" type="xsd:positiveInteger"
use="required" />
	</xsd:complexType>	
	
	<xsd:simpleType name="StatusType">
		<xsd:restriction base="xsd:string">
			<xsd:enumeration value="5"/>
			<xsd:enumeration value="8"/>
		</xsd:restriction>
	</xsd:simpleType>
</xsd:schema>

My build script is also similar to the example, it contains
     <path id="generate.class.path">
        <pathelement location="${mstest.classpath}/jaxme2-0.5.2.jar"/>
        <pathelement location="${mstest.classpath}/jaxmejs-0.5.2.jar"/>
        <pathelement location="${mstest.classpath}/jaxmexs-0.5.2.jar"/>
        <pathelement location="${mstest.classpath}/jaxmeapi-0.5.2.jar"/>
      </path>

     <xjc 
        schema="Application.xsd" 
        target="${mstest.home}"
		resourceTarget="${mstest.home}"
		removeOldOutput="true"
		package="ca.mb.gov.fsh.mstest">
            <produces includes="ca/mb/gov/fsh/mstest/*.java"/>
      </xjc>


-----Original Message-----
From: Robert Eric Reeves [mailto:robert@phurnace.com] 
Sent: Friday, December 29, 2006 11:14 AM
To: Huang, Sheng (FSH)
Cc: jaxme-dev@ws.apache.org
Subject: Re: Question about pattern/enumeration constraint from Sheng

Yep, I've got enumeration working throughout my XSD. Maybe there is 
another bug with the datatype "positiveInteger". I use "xsd:string" for 
all my enumerations. (Not by choice, it's just that they just so happen 
to be strings.)

It sounds like you're doing some pretty good testing of  JaxMe to make 
sure it works for your needs. I'm sure Jochen will check it out and get 
back to you to give you a final answer.

Robert

Huang, Sheng (FSH) wrote:
> Good morning Rob,
>
> Thanks a lot for your help. Actually I tried enumeration exactly as
your
> code sample before, however it is also not working.
>
> I tried address.xsd under \ws-jaxme-0.5.2\examples\xs\primer\, it
works
> in the same way (no code is created for validating USState or
UKPostcode
> in that example).
>
> Have you ever got enumeration working? Or something else I might be
> missing?  
>
> Best regards,
> Sheng
>
> -----Original Message-----
> From: Robert Eric Reeves [mailto:robert@phurnace.com] 
> Sent: Friday, December 29, 2006 10:56 AM
> To: Huang, Sheng (FSH)
> Cc: jaxme-dev@ws.apache.org
> Subject: Re: Question about pattern/enumeration constraint from Sheng
>
> That does look like a bug to me.
>
> A work around until it's fixed might be to use enumeration. In fact, I

> would recommend that because it's easier to read -- at least for me...
>
>
>       <xsd:simpleType name="StatusType">
>
>             <xsd:restriction base="xsd:positiveInteger">
>
>                <xsd:enumeration value="5"/>
>
>                <xsd:enumeration value="8"/>
>
>             </xsd:restriction>
>
>       </xsd:simpleType>
>
>
>
> Huang, Sheng (FSH) wrote:
>   
>> Good morning,
>>
>>  
>>
>> I am trying JAXME 0.5.2 and I can run some examples as well as create

>> some simple programs.
>>
>>  
>>
>> However, I have problem with creating a constraint to only allow 
>> integer 5 and 8 as the status. It seems that pattern and enumeration 
>> are not working.
>>
>>       <xsd:simpleType name="StatusType">
>>
>>             <xsd:restriction base="xsd:positiveInteger">
>>
>>                <xsd:pattern value="5|8"/>
>>
>>             </xsd:restriction>
>>
>>       </xsd:simpleType>
>>
>>  
>>
>> In generated Impl class, I cannot find code to check whether status
is
>>     
>
>   
>> 5 or 8, and throw exception otherwise. I run the program and no error

>> is thrown for other values. But constraint like
>>
>>                               <xsd:restriction base="xsd:string">
>>
>>                                     <xsd:maxLength value="50" />
>>
>>                               </xsd:restriction>
>>
>> work well and I can find the code in corresponding Impl class to
check
>>     
>
>   
>> length.
>>
>>  
>>
>> Would you please give me a hint about what I am wrong or whether
those
>>     
>
>   
>> features are supported? Thank you very much for your help.
>>
>>  
>>
>> Have a good day.
>>
>>  
>>
>> Best regards,
>>
>> Sheng
>>
>>     
>
>   


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


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


RE: Question about pattern/enumeration constraint from Sheng

Posted by "Huang, Sheng (FSH)" <SH...@gov.mb.ca>.
Good morning Rob,

Thanks a lot for the quick reply again. Actually I have also tried
xsd:string but the same problem persists.

I have attached segments of my XSD and build script as follows so that
Jochen can have more clues about what might cause the problem. Thank you
very much for your help.

Have a happy new year!

Best regards,
Sheng

************************************************************************
*
A section of my XSD is as follows:
<?xml version="1.0" encoding="UTF-8"?>

<xsd:schema targetNamespace="http://www.gov.mb.ca/mstest"
			xmlns:xsd="http://www.w3.org/2001/XMLSchema"
			xmlns:mstest="http://www.gov.mb.ca/mstest"
			xml:lang="EN"
			elementFormDefault="qualified"
			attributeFormDefault="unqualified">

	<xsd:element name="application" type="mstest:ApplicationType" />
	<xsd:complexType name="ApplicationType">
		<xsd:sequence>
			<xsd:element name="applicationId"
type="xsd:positiveInteger" minOccurs="1" maxOccurs="1" />
			<xsd:element name="applicationStatus"
minOccurs="1" maxOccurs="1" type="mstest:StatusType">
			</xsd:element>
			<xsd:element name="remarks" minOccurs="1"
maxOccurs="1">
				<xsd:simpleType>
					<xsd:restriction
base="xsd:string">
						<xsd:maxLength
value="50" />
					</xsd:restriction>
				</xsd:simpleType>
			</xsd:element>
		</xsd:sequence>
		<xsd:attribute name="id" type="xsd:positiveInteger"
use="required" />
	</xsd:complexType>	
	
	<xsd:simpleType name="StatusType">
		<xsd:restriction base="xsd:string">
			<xsd:enumeration value="5"/>
			<xsd:enumeration value="8"/>
		</xsd:restriction>
	</xsd:simpleType>
</xsd:schema>

My build script is also similar to the example, it contains
     <path id="generate.class.path">
        <pathelement location="${mstest.classpath}/jaxme2-0.5.2.jar"/>
        <pathelement location="${mstest.classpath}/jaxmejs-0.5.2.jar"/>
        <pathelement location="${mstest.classpath}/jaxmexs-0.5.2.jar"/>
        <pathelement location="${mstest.classpath}/jaxmeapi-0.5.2.jar"/>
      </path>

     <xjc 
        schema="Application.xsd" 
        target="${mstest.home}"
		resourceTarget="${mstest.home}"
		removeOldOutput="true"
		package="ca.mb.gov.fsh.mstest">
            <produces includes="ca/mb/gov/fsh/mstest/*.java"/>
      </xjc>


-----Original Message-----
From: Robert Eric Reeves [mailto:robert@phurnace.com] 
Sent: Friday, December 29, 2006 11:14 AM
To: Huang, Sheng (FSH)
Cc: jaxme-dev@ws.apache.org
Subject: Re: Question about pattern/enumeration constraint from Sheng

Yep, I've got enumeration working throughout my XSD. Maybe there is 
another bug with the datatype "positiveInteger". I use "xsd:string" for 
all my enumerations. (Not by choice, it's just that they just so happen 
to be strings.)

It sounds like you're doing some pretty good testing of  JaxMe to make 
sure it works for your needs. I'm sure Jochen will check it out and get 
back to you to give you a final answer.

Robert

Huang, Sheng (FSH) wrote:
> Good morning Rob,
>
> Thanks a lot for your help. Actually I tried enumeration exactly as
your
> code sample before, however it is also not working.
>
> I tried address.xsd under \ws-jaxme-0.5.2\examples\xs\primer\, it
works
> in the same way (no code is created for validating USState or
UKPostcode
> in that example).
>
> Have you ever got enumeration working? Or something else I might be
> missing?  
>
> Best regards,
> Sheng
>
> -----Original Message-----
> From: Robert Eric Reeves [mailto:robert@phurnace.com] 
> Sent: Friday, December 29, 2006 10:56 AM
> To: Huang, Sheng (FSH)
> Cc: jaxme-dev@ws.apache.org
> Subject: Re: Question about pattern/enumeration constraint from Sheng
>
> That does look like a bug to me.
>
> A work around until it's fixed might be to use enumeration. In fact, I

> would recommend that because it's easier to read -- at least for me...
>
>
>       <xsd:simpleType name="StatusType">
>
>             <xsd:restriction base="xsd:positiveInteger">
>
>                <xsd:enumeration value="5"/>
>
>                <xsd:enumeration value="8"/>
>
>             </xsd:restriction>
>
>       </xsd:simpleType>
>
>
>
> Huang, Sheng (FSH) wrote:
>   
>> Good morning,
>>
>>  
>>
>> I am trying JAXME 0.5.2 and I can run some examples as well as create

>> some simple programs.
>>
>>  
>>
>> However, I have problem with creating a constraint to only allow 
>> integer 5 and 8 as the status. It seems that pattern and enumeration 
>> are not working.
>>
>>       <xsd:simpleType name="StatusType">
>>
>>             <xsd:restriction base="xsd:positiveInteger">
>>
>>                <xsd:pattern value="5|8"/>
>>
>>             </xsd:restriction>
>>
>>       </xsd:simpleType>
>>
>>  
>>
>> In generated Impl class, I cannot find code to check whether status
is
>>     
>
>   
>> 5 or 8, and throw exception otherwise. I run the program and no error

>> is thrown for other values. But constraint like
>>
>>                               <xsd:restriction base="xsd:string">
>>
>>                                     <xsd:maxLength value="50" />
>>
>>                               </xsd:restriction>
>>
>> work well and I can find the code in corresponding Impl class to
check
>>     
>
>   
>> length.
>>
>>  
>>
>> Would you please give me a hint about what I am wrong or whether
those
>>     
>
>   
>> features are supported? Thank you very much for your help.
>>
>>  
>>
>> Have a good day.
>>
>>  
>>
>> Best regards,
>>
>> Sheng
>>
>>     
>
>   


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


Re: Question about pattern/enumeration constraint from Sheng

Posted by Robert Eric Reeves <ro...@phurnace.com>.
Yep, I've got enumeration working throughout my XSD. Maybe there is 
another bug with the datatype "positiveInteger". I use "xsd:string" for 
all my enumerations. (Not by choice, it's just that they just so happen 
to be strings.)

It sounds like you're doing some pretty good testing of  JaxMe to make 
sure it works for your needs. I'm sure Jochen will check it out and get 
back to you to give you a final answer.

Robert

Huang, Sheng (FSH) wrote:
> Good morning Rob,
>
> Thanks a lot for your help. Actually I tried enumeration exactly as your
> code sample before, however it is also not working.
>
> I tried address.xsd under \ws-jaxme-0.5.2\examples\xs\primer\, it works
> in the same way (no code is created for validating USState or UKPostcode
> in that example).
>
> Have you ever got enumeration working? Or something else I might be
> missing?  
>
> Best regards,
> Sheng
>
> -----Original Message-----
> From: Robert Eric Reeves [mailto:robert@phurnace.com] 
> Sent: Friday, December 29, 2006 10:56 AM
> To: Huang, Sheng (FSH)
> Cc: jaxme-dev@ws.apache.org
> Subject: Re: Question about pattern/enumeration constraint from Sheng
>
> That does look like a bug to me.
>
> A work around until it's fixed might be to use enumeration. In fact, I 
> would recommend that because it's easier to read -- at least for me...
>
>
>       <xsd:simpleType name="StatusType">
>
>             <xsd:restriction base="xsd:positiveInteger">
>
>                <xsd:enumeration value="5"/>
>
>                <xsd:enumeration value="8"/>
>
>             </xsd:restriction>
>
>       </xsd:simpleType>
>
>
>
> Huang, Sheng (FSH) wrote:
>   
>> Good morning,
>>
>>  
>>
>> I am trying JAXME 0.5.2 and I can run some examples as well as create 
>> some simple programs.
>>
>>  
>>
>> However, I have problem with creating a constraint to only allow 
>> integer 5 and 8 as the status. It seems that pattern and enumeration 
>> are not working.
>>
>>       <xsd:simpleType name="StatusType">
>>
>>             <xsd:restriction base="xsd:positiveInteger">
>>
>>                <xsd:pattern value="5|8"/>
>>
>>             </xsd:restriction>
>>
>>       </xsd:simpleType>
>>
>>  
>>
>> In generated Impl class, I cannot find code to check whether status is
>>     
>
>   
>> 5 or 8, and throw exception otherwise. I run the program and no error 
>> is thrown for other values. But constraint like
>>
>>                               <xsd:restriction base="xsd:string">
>>
>>                                     <xsd:maxLength value="50" />
>>
>>                               </xsd:restriction>
>>
>> work well and I can find the code in corresponding Impl class to check
>>     
>
>   
>> length.
>>
>>  
>>
>> Would you please give me a hint about what I am wrong or whether those
>>     
>
>   
>> features are supported? Thank you very much for your help.
>>
>>  
>>
>> Have a good day.
>>
>>  
>>
>> Best regards,
>>
>> Sheng
>>
>>     
>
>   


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


RE: Question about pattern/enumeration constraint from Sheng

Posted by "Huang, Sheng (FSH)" <SH...@gov.mb.ca>.
Good morning Rob,

Thanks a lot for your help. Actually I tried enumeration exactly as your
code sample before, however it is also not working.

I tried address.xsd under \ws-jaxme-0.5.2\examples\xs\primer\, it works
in the same way (no code is created for validating USState or UKPostcode
in that example).

Have you ever got enumeration working? Or something else I might be
missing?  

Best regards,
Sheng

-----Original Message-----
From: Robert Eric Reeves [mailto:robert@phurnace.com] 
Sent: Friday, December 29, 2006 10:56 AM
To: Huang, Sheng (FSH)
Cc: jaxme-dev@ws.apache.org
Subject: Re: Question about pattern/enumeration constraint from Sheng

That does look like a bug to me.

A work around until it's fixed might be to use enumeration. In fact, I 
would recommend that because it's easier to read -- at least for me...


      <xsd:simpleType name="StatusType">

            <xsd:restriction base="xsd:positiveInteger">

               <xsd:enumeration value="5"/>

               <xsd:enumeration value="8"/>

            </xsd:restriction>

      </xsd:simpleType>



Huang, Sheng (FSH) wrote:
>
> Good morning,
>
>  
>
> I am trying JAXME 0.5.2 and I can run some examples as well as create 
> some simple programs.
>
>  
>
> However, I have problem with creating a constraint to only allow 
> integer 5 and 8 as the status. It seems that pattern and enumeration 
> are not working.
>
>       <xsd:simpleType name="StatusType">
>
>             <xsd:restriction base="xsd:positiveInteger">
>
>                <xsd:pattern value="5|8"/>
>
>             </xsd:restriction>
>
>       </xsd:simpleType>
>
>  
>
> In generated Impl class, I cannot find code to check whether status is

> 5 or 8, and throw exception otherwise. I run the program and no error 
> is thrown for other values. But constraint like
>
>                               <xsd:restriction base="xsd:string">
>
>                                     <xsd:maxLength value="50" />
>
>                               </xsd:restriction>
>
> work well and I can find the code in corresponding Impl class to check

> length.
>
>  
>
> Would you please give me a hint about what I am wrong or whether those

> features are supported? Thank you very much for your help.
>
>  
>
> Have a good day.
>
>  
>
> Best regards,
>
> Sheng
>


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


Re: Question about pattern/enumeration constraint from Sheng

Posted by Robert Eric Reeves <ro...@phurnace.com>.
That does look like a bug to me.

A work around until it's fixed might be to use enumeration. In fact, I 
would recommend that because it's easier to read -- at least for me...


      <xsd:simpleType name="StatusType">

            <xsd:restriction base="xsd:positiveInteger">

               <xsd:enumeration value="5"/>

               <xsd:enumeration value="8"/>

            </xsd:restriction>

      </xsd:simpleType>



Huang, Sheng (FSH) wrote:
>
> Good morning,
>
>  
>
> I am trying JAXME 0.5.2 and I can run some examples as well as create 
> some simple programs.
>
>  
>
> However, I have problem with creating a constraint to only allow 
> integer 5 and 8 as the status. It seems that pattern and enumeration 
> are not working.
>
>       <xsd:simpleType name="StatusType">
>
>             <xsd:restriction base="xsd:positiveInteger">
>
>                <xsd:pattern value="5|8"/>
>
>             </xsd:restriction>
>
>       </xsd:simpleType>
>
>  
>
> In generated Impl class, I cannot find code to check whether status is 
> 5 or 8, and throw exception otherwise. I run the program and no error 
> is thrown for other values. But constraint like
>
>                               <xsd:restriction base="xsd:string">
>
>                                     <xsd:maxLength value="50" />
>
>                               </xsd:restriction>
>
> work well and I can find the code in corresponding Impl class to check 
> length.
>
>  
>
> Would you please give me a hint about what I am wrong or whether those 
> features are supported? Thank you very much for your help.
>
>  
>
> Have a good day.
>
>  
>
> Best regards,
>
> Sheng
>


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