|
From: R.J. L. <rjl...@co...> - 2004-10-07 19:48:14
|
I read in the DTD: " As the format is simple, a DTD is sufficient, and there's no need for a schema at this point." ... But I thought for the heck of it I would try to come up with a = schema that addressed the shortcomings that will be in the DTD if this new = style of property tag was introduced. I think I have come up with one = implementation, although it seems filled with hacks to get around the shortcomings in = XSDs. I only implemented the theoretical discussions from today, so a lot of = the tags aren't defined completely - not to mention the fact that I didn't = test this implementation; I just relied on my prior experience regarding = schemas. It is nasty to look at, but given some tweaking it should be a correct implementation that covers the two concerns brought up by Winter (it shouldn't be possible to implement both attribute and element style = property values) and Seth (each attribute should be mutually exclusive in the attribute style property tag). <xs:element name=3D"bean"> <xs:complexType> <xs:group minOccurs=3D"0" maxOccurs=3D"unbounded"> <xs:choice> <!-- Hack 1: elements with the same name can't share a 'choice' namespace in a schema (or sequence or group for that matter), so the sequence=20 tags have to be used to separate them. --> <xs:sequence> <xs:element name=3D"property" type=3D"beanAttrStyleProperty"/> </xs:sequence> <xs:sequence> <xs:element name=3D"property" type=3D"localAttrStyleProperty"/> </xs:sequence> <xs:sequence> <xs:element name=3D"property" type=3D"valueStyleProperty"/> </xs:sequence> <xs:sequence> <xs:element name=3D"property" type=3D"elemStyleProperty"/> </xs:sequence> </xs:choice> </xs:group> </xs:complexType> </xs:element> <!--=20 Hack 2: there is no 'attributeChoice' style tag, so=20 a different property type has to be hacked out=20 for each attribute combination (biggest oversight in XSDs I think). --> <xs:complexType name=3D"beanAttrStyleProperty"> <xs:attribute name=3D"ref-bean" type=3D"xs:string"/>=09 </xs:complexType> <xs:complexType name=3D"localAttrStyleProperty"> <xs:attribute name=3D"ref-bean" type=3D"xs:string"/>=09 </xs:complexType> <xs:complexType name=3D"valueAttrStyleProperty"> <xs:attribute name=3D"value" type=3D"xs:string"/>=09 </xs:complexType> <xs:complexType name=3D"elemStyleProperty"> <xs:choice> <!--=20 Hack 1 and Hack 2 Combined: Here is another example of the two different hacks employed=20 above, this time in a nested (inline) format. --> <xs:sequence> <xs:element name=3D"ref"> <xs:complexType> <xs:attribute name=3D"bean" type=3D"xs:string"/> </xs:complexType> </xs:element> </xs:sequence> <xs:sequence> <xs:element name=3D"ref"> <xs:complexType> <xs:attribute name=3D"local" type=3D"xs:string"/> </xs:complexType> </xs:element> </xs:sequence> <xs:element name=3D"value" type=3D"xs:string"/> </xs:choice> </xs:complexType> --- As I said, this isn't tested - it's really just an academic exercise. = That being said, it does look like full schema validation would be possible = even though (I don't believe) full DTD validation would be possible. R.J. -----Original Message----- From: spr...@li... [mailto:spr...@li...] On Behalf = Of Seth Ladd Sent: Thursday, October 07, 2004 1:34 PM To: spr...@li... Subject: Re: [Springframework-developer] Simplify typical xml setup = syntax On Thu, 7 Oct 2004 15:09:01 +0200, j=FCrgen h=F6ller [ werk3AT ] <jue...@we...> wrote: > Another request to simply <property> usage in XML bean definitions: >=20 > http://opensource.atlassian.com/projects/spring/browse/SPR-379 >=20 > This time, it's not about considering CDATA inside <property>...</property> as value, but rather about further attributes = for the <property> tag itself: >=20 > <property name=3D"user" value=3D"admin"/> > <property name=3D"linkFormatter" bean=3D"linkFormatter"/> +1 on this. Although, can the DTD say that value OR bean but not both? Seth ------------------------------------------------------- This SF.net email is sponsored by: IT Product Guide on ITManagersJournal = Use IT products in your business? Tell us what you think of them. Give us = Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more http://productguide.itmanagersjournal.com/guidepromo.tmpl _______________________________________________ Springframework-developer mailing list Spr...@li... https://lists.sourceforge.net/lists/listinfo/springframework-developer |