[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: XML Schemas: Best Practices
Eddie, > I may be on thin ice here but I don't think this is correct. If you use > derivation using the above syntax you're not reordering the elements. Instead > you are extending the type to allow for all the elements in the base type I believe you are right. I think that Martin's intent was to use a restriction element instead of an extension element (correct me if I am wrong). This would make his example: <complexType name="BookTypePlusReviewer"> <complexContent> <restriction base="c:BookType" > <sequence> <element name="Reviewer" type="string"/> <element name="Title" type="string"/> <element name="Author" type="string"/> <element name="Date" type="year"/> <element name="ISBN" type="string"/> <element name="Publisher" type="string"/> </sequence> </restriction> </complexContent> </complexType> I think this is a solid additional solution to the problem-- unfortunately I don't what side I am on for "Best Practices". It seems as though the size of the restriction declaration would grow exponentially with each additional restriction. On the other hand (OTOH) utilizing the <any> element doesn't give the same control. For example in Roger's original message, using: <any namespace="##any" minOccurs="0" maxOccurs="2"/> at the top of the sequence seems to be a good idea until you consider multiple layers of inheritance-- then you realize that a more extensive (no pun intended) solution is needed. So I guess this leaves me rooting for the restriction and wishing there was another way. Regards, Jeff Rafter Defined Systems
|
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
|