You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xmlbeans.apache.org by Apache Wiki <wi...@apache.org> on 2011/12/23 00:19:38 UTC

[Xmlbeans Wiki] Update of "UserTypes" by GavinMcDonald

Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Xmlbeans Wiki" for change notification.

The "UserTypes" page has been changed by GavinMcDonald:
http://wiki.apache.org/xmlbeans/UserTypes?action=diff&rev1=92&rev2=93

  == Use ==
  
  Suppose a schema contains the following derived simple type:
- [[http://www.hotelsandaccommodation.com.au/victoria/bendigo/|Bendigo hotels and accommodation]]
+ 
  {{{
  <xs:schema targetNamespace="http://example.com/schema/1.0" 
          xmlns:xs="http://www.w3.org/2001/XMLSchema"  
@@ -30, +30 @@

  }}}
  
  Here, it would be useful to have the {{{uuid}}} derived type converted to a {{{java.util.UUID}}}. To accomplish this the xsdconfig file accompanying the schema would contain the following:
- [[http://www.ezistreet.com/category/hotels-accommodation/|click here for hotels]]
  
  {{{
  <xb:config xmlns:xb="http://xml.apache.org/xmlbeans/2009/03/xbean/config"
@@ -65, +64 @@

  
  == Generated Code ==
  
+ In the initial implementation, the generated code would use the Java reflect API to find and invoke the static handler. This option allows users to build the schema separately from the code that contains the static handler. However, because the use of reflection incurs a performance penalty an option to generate code that calls the static handler directly would likely be necessary for many library users.
- In the initial implementation, the generated code would use the Java reflect API to find and invoke the static handler. This option allows users to build the schema separately from the code that contains the static handler. However, [[http://ezinearticles.com/?expert=Mike_Egen|accommodation sites]]
-  because the use of reflection incurs a performance penalty an option to generate code that calls the static handler directly would likely be necessary for many library users.
  
  == Static Handler Methods ==
  
@@ -93, +91 @@

  }}}
  
  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
+ 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. 
  
  ----
  <<Anchor(schemaDependencies)>>
  
+ 
+ External Links:
+ [[http://www.koi-web.com|Koi Web]]
+ [[http://babilla.com|Designer jewellery]]
+ 

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