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 <[EMAIL PROTECTED]> 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:[EMAIL PROTECTED] 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. <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]