[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: RE: [Summary #2] Should Subject Matter Experts Determine X
Roger,
I'd also agree that this is a case of inadequately determining requirements, but I'd also argue that this is one of those situations where a difference in design in the first place may have been more appropriate. Consider the original example: <Payment> <Method>Paypal</Method> <Method>money order</Method> <Method>cashier's check</Method> </Payment> In this particular case, the use of an alternate envelope doesn't make a lot of sense here - it makes it more difficult to write queries against it, it makes it more difficult to build interfaces around it, and so forth. To me, this is one of those cases where you'd be better of going with an attribute, especially once the model has been produced: <Payment> <Method monetized="true">Paypal</Method> <Method monetized="false">money order</Method> <Method monetized="false">cashier's check</Method> </Payment> and of course, you can set a default on the attribute in at least XSD, if this is getting verbose: <Payment> <Method monetized="true">Paypal</Method> <Method>money order</Method> <Method>cashier's check</Method> </Payment> The advantage here is that your enumerations remain simple, as an XQuery that populates a list option might illustrate let $payment := $myObj//Payment[1] let $selectBox := <select> {for $method in $payment return <option value="{string($method)}" selected="{if ($method/@monetized='true') then 'selected' else ''}">{string($method)}</option> } </select> The point I'm trying to make here though is that in general, when designing a schema that's already in active use, design such that structure remains backward compatible and that properties changes that manifest are either additions to the existing scheme (with an informal agreement to deprecate the use of a given element that is no longer in use) or are attributes that determine the characteristics of the object so being modeled. Schemas evolved, and sometimes you do have to go in and redesign from the ground up ... but this should definitely be a major version type of change with the understanding that less significant changes should augment rather than rearrange structure until such time as the schema requires major rework. -- Kurt On Tue, Oct 14, 2008 at 4:45 PM, Costello, Roger L. <costello@m...> wrote:
-- Kurt Cagle Managing Editor, http://xml.com O'Reilly kurt@o...
[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
|