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

List:       xmlbeans-dev
Subject:    Re: [PATCH 1 of 1] Added custom user type support
From:       Wesley Leggette <wleggette () cleversafe ! com>
Date:       2009-03-29 5:39:06
Message-ID: C5F473AA.AEC5%wleggette () cleversafe ! com
[Download RAW message or body]


I've updated the text to read:

As XMLBeans is designed around a "start-from-Schema" use case, the encode
and decode methods must be written such that they are able to handle any
value that is valid against the schema. Because validation is an optional
operation when loading XML there may be cases when a decoder would be called
with invalid input. In such cases either
org.apache.xmlbeans.impl.values.XmlValueNotSupportedException or
XmlValueOutOfRangeException should be thrown from the decode method. Such
exceptions should not be thrown in cases where the XML input has been
successfully validated against the schema (this is just another way of
stressing that the decoder must accept all valid input according to the XML
Schema). The encoder should never throw such an exception.


Thanks,
Wesley


On 3/24/09 15:58, "Radu Preotiuc-Pietro" <radu.preotiuc-pietro@oracle.com>
wrote:

> Hi,
> 
> One thing is that XMLBeans really is designed around a start-from-Schema
> usecase and a lot of our users are in the situation where the XMLSchema is
> given and they cannot change it. So it would make more sense to say that the
> decode/encode methods must be written in such a way that they are able to
> handle any value that is valid against the Schema.
> 
> For the cases where validation is not performed (and the value happens to be
> outside of the supported range),
> org.apache.xmlbeans.impl.values.XmlValueNotSupportedException (or
> XmlValueOutOfRangeException) would make sense.
> 
> Radu 
> 
>> -----Original Message-----
>> From: Wesley Leggette [mailto:wleggette@cleversafe.com]
>> Sent: Sunday, March 22, 2009 12:08 PM
>> To: dev@xmlbeans.apache.org; Radu Preotiuc
>> Subject: Re: [PATCH 1 of 1] Added custom user type support
>> 
>> 
>> 
>> 
>>> 
>>> Oh, and also, the Wiki presentation of the feature is
>> great, but it's 
>>> missing a description of the methods in the handler class. I had to
>>> look at the code to figure out that the method name is
>> "encode/decode" 
>>> + unqualified name of the user type. Maybe encode/decode
>> would suffice?
>>> Anyway, it has to be documented.
>>> 
>> 
>> I added this description to the wiki:
>> 
>> The XML Schema should be written in a way to ensure that all
>> possible validated {{{SimpleValue}}} input is acceptable. As
>> such, the static handler methods should not throw checked or
>> runtime exceptions if schema validation was successful. In
>> the case where XML validation was not successful it is
>> expected that a runtime exception may be thrown from the
>> static handler method. If callers of the generated code do
>> not validate input before using the convenience methods they
>> should be prepared to handle undefined runtime exceptions.
>> 
>> Is this reasonable, or is there a specific exception (either
>> runtime or
>> checked) that is customary to throw from convenience methods?
>> 
>> Wesley
>> 
>> 
>> 
> 
> 
> ---------------------------------------------------------------------
> 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

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

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