Re: XML data binding and schema styles
Hi Andrew, Data binding tools generally have fairly primitive support for schema. Most treat unions, for instance, as just strings, and nested compositors with maxOccurs > 1 will often result in an API that has an array of undifferentiated element components (perhaps with a parallel array of type codes) without regard to the ordering or occurs restrictions given in the schema definition. So you're best off sticking with fairly simple constructs, and the salami slice style is a good match in that regard. XMLBeans does a better job than most data binding frameworks of exposing the schema model in the generated code, but on the other hand it doesn't enforce most aspects unless you actually use validation. It's very easy with XMLBeans to generate invalid XML documents by forgetting to set a required value, for instance - XMLBeans will happily marshal whatever you do set, without any complaint about the missing values (and will also ignore missing required values when unmarshalling, for that matter). Most other data binding frameworks would throw an exception if you're missing a required value on either marshalling or unmarshalling. - 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 Andrew Welch wrote: > I asked the questions below on the user@x... mailing > list but haven't had a reply yet - a more general question for this > list is: do schema styles make a siginificant difference when it comes > to data-binding? As in, "if you are using binding tool x, you should > use style y"? Or is there a style that suits all data binding, and a > style that definitely doesn't? > > The XMLBeans specific question was: > > == > > I'm using XMLBeans for data binding (for the first time) which is > generating classes for all top-level elements with the name > nnnnDocument, such as priceDocument for the global element price, > dateDocument for date etc > > The schema style I've used is the salami slice style, where each > element is known globally. This means the schema can potentially be > used for schema aware XSLT / XQuery (which require that the elements > are known globally). > > Is there any way to supply XMLBeans with the element to use as the > root element, such that only the generated class for that element ends > with "Document", and not the others ? > > Does XMLBeans and the salami slice style of schema not go well together ? > > == > > thanks > >
[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!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format