[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: XML data binding and schema styles

  • From: Dennis Sosnoski <dms@s...>
  • To: d_a_carver@y...
  • Date: Sun, 14 Oct 2007 11:48:17 +1300

Re:  XML data binding and schema styles
David Carver wrote:
> ... 
> The comments raised, really apply to all XML Databinding frameworks.  
> XMLBeans is one of the more compliant implementations out there, but
> regardless of which Databinding framework you use, you should ALWAYS
> validate the instance it generates.   The problem with data binding
> frameworks in general with XML is that people assume that because the
> classes were generated from a schema, that it will automatically
> generate the correct XML instance that is also valid against the
> schema.  This unfortunately isn't true, and JAXB 2.x exhibts the same
> problems that XMLBeans does.  The difference, is that XML Beans does
> correctly support more of the schema concepts than most other binding
> frameworks.

It's true that JAXB 2.x is also very sloppy on marshalling, but XMLBeans
is the only data binding approach I'm aware of which will unmarshal
without required elements present. Most other data binding frameworks
(JAXB 2.x aside), at least in the Java world, will throw an exception on
such basic errors as missing required elements or attributes when either
marshalling or unmarshalling.

One important point to keep in mind is that XMLBeans is not really a
data binding framework at all. Rather, it implements a data binding
facade on top of an XML memory image. That gives XMLBeans some unique
features, including full integration with DOM and XPath/XQuery, and
means that for general XML usage XMLBeans is a great tool. But for
applications that specifically want to do data binding XMLBeans is a
poor choice, with higher memory and processing overhead than most data
binding frameworks along with looser enforcement of document correctness.

As to validation, I strongly recommend that people use validation during
testing. In my experience, though, it's rarely used in production due to
the high overhead involved. In the longer run, the data binding
frameworks should be improved to the point where they *do* automatically
generate the correct XML instance that is also valid against the schema,
or at least make it much more difficult to read and write invalid
documents than at present.

  - Dennis

-- 
Dennis M. Sosnoski
SOA and Web Services in Java
Training and Consulting
http://www.sosnoski.com - http://www.sosnoski.co.nz
Seattle, WA +1-425-939-0576 - Wellington, NZ +64-4-298-6117



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.