[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xmlbeans-dev
Subject:    RE: Enumerated types
From:       "Kuang, Siwei" <Siwei.Kuang () CommerceBank ! com>
Date:       2007-07-17 17:01:22
Message-ID: 7531AAD92EE14C4CB72BFE3A677A87FE048E1195 () kc-exc3 ! cbsh ! com
[Download RAW message or body]

Yeah, this is what I did to remove the enumeration block from schema.
Also, I tried the XmlOption - setCompileNoValidation() as well as
passing "null" for XmlOption. Neither of them really works.

Schemas were created by somebody else long ago. I wish there were an
option to easily enable/disable the enumeration check without having to
modify the schema.

Thanks for your reply, though.

Siwei 

-----Original Message-----
From: Jacob Danner [mailto:jacob.danner@gmail.com] 
Sent: Tuesday, July 17, 2007 11:55 AM
To: user@xmlbeans.apache.org
Cc: dev@xmlbeans.apache.org
Subject: Re: Enumerated types

Hi Siwei,
I have to ask, why the need for enumerations if you don't want the check
or validation. Why not just use a String type?
As far as I understand xsd:enumerations to work, they say, you can only
use value A, B, or C. If the value is NOT A, B,  or C then this is not a
valid enumeration.


Back to your problem, if you are doing something like
SomeXmlObject.Factory.parse(...)
and don't want this to fail validation, you might be able to try using
the XmlOptions API with methods setCompileNoValidation()

Hope this helps,
-Jacob Danner

On 7/17/07, Kuang, Siwei <Siwei.Kuang@commercebank.com> wrote:
> I have a different issue about the enumeration from Xmlbeans. I look 
> for a way to enable or disable enumeration check without having to 
> modify, (say, add/remove one item defined in the schema enumeration 
> block and recompile to Java type via Xmlbeans). In other words, I try 
> to find a way to by-pass the enumeration validation check when parsing

> an XML document.
>
> There are always new items from XML document beyond what have already 
> defined in the schema enumeration block. If this happens, Xmlbeans 
> always give an error, saying "XmlOutofRangeException". I was intent to

> work around this without modifying the schema, but couldn't get it
work.
>
> Any idea or suggestion is appreciated.
>
> Siwei Kuang
>
> -----Original Message-----
> From: Jacob Danner [mailto:jacob.danner@gmail.com]
> Sent: Tuesday, July 17, 2007 10:20 AM
> To: dev@xmlbeans.apache.org
> Subject: Re: Enumerated types base index
>
> Hi Jason,
> I'm not sure why this is the case, but if its really an issue, I think

> you could modify the generated src or modify your index to start at
one.
>
>  static final int INT_FOO = 1;
>  static final int INT_BAZ = 2;
>
> I've attached an example src file in case you wanted to peek at it.
> I've never needed an Enum value to have a int val beginning at zero
>
> switch(enumVal)
>       case Enum.INT_FOO:
>          doSomething();
>          break;
>      // ....
>
> And so using this code, I do not need the enumeration value to be a 
> specific int. This also makes the code a little easier to read as
well.
>
> Hope this helps,
> -Jacob Danner
>
>
> On 7/17/07, Green, Jason M. <jason.green@ngc.com> wrote:
> >
> >
> >
> > Hey all,
> > I have been attempting to use the Enum.forInt method for some of my 
> > enumerated types.  I am passing in a value that is provided in a 
> > text
> file.
> > Often times the value is zero, but when I pass that in, I get a 
> > XmlValueNotNillableException.  I know what this means, but I am 
> > confused as to why the enumerated values would start at 1 and not 0.
> > In the schema, there is obv no numberign associated.  Since nearly 
> > every language that I know of is 0 based, why would this be 1 based?
> > Is there a way to change this?
> >
> > Thanks,
> >
> > Jason
>
>
>
> **********************************************************************
> ******* If you wish to communicate securely with Commerce Bank and its

> affiliates, you must log into your account under Online Services at 
> http://www.commercebank.com or use the Commerce Bank Secure Email 
> Message Center at https://securemail.commercebank.com
>
> NOTICE: This electronic mail message and any attached files are 
> confidential. The information is exclusively for the use of the 
> individual or entity intended as the recipient. If you are not the 
> intended recipient, any use, copying, printing, reviewing, retention, 
> disclosure, distribution or forwarding of the message or any attached 
> file is not authorized and is strictly prohibited.
> If you have received this electronic mail message in error, please 
> advise the sender by reply electronic mail immediately and permanently

> delete the original transmission, any attachments and any copies of 
> this message from your computer system.
> **********************************************************************
> *******
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@xmlbeans.apache.org
> For additional commands, e-mail: dev-help@xmlbeans.apache.org
>
>

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




*****************************************************************************
If you wish to communicate securely with Commerce Bank and its
affiliates, you must log into your account under Online Services at 
http://www.commercebank.com or use the Commerce Bank Secure
Email Message Center at https://securemail.commercebank.com

NOTICE: This electronic mail message and any attached files are
confidential. The information is exclusively for the use of the
individual or entity intended as the recipient. If you are not
the intended recipient, any use, copying, printing, reviewing,
retention, disclosure, distribution or forwarding of the message
or any attached file is not authorized and is strictly prohibited.
If you have received this electronic mail message in error, please
advise the sender by reply electronic mail immediately and
permanently delete the original transmission, any attachments
and any copies of this message from your computer system.
*****************************************************************************

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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic