This question here asks about default values specified in an XSD file. Basically you can say the field "foo" defaults to value "bar"
What I want to know... is it possible to have a field default as the value in another field? If field "foo" is "bar" and "otherfoo" is empty, can I say it's default is the value in "foo"... something along the lines of:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="button" type="button"/>
<xs:complexType name="button">
<xs:attribute name="id" type="xs:string"/>
<xs:attribute name="label1" type="xs:string" default="Go"/>
<xs:attribute name="label2" type="xs:string" def开发者_JAVA百科ault=label1/>
</xs:complexType>
</xs:schema>
<button id="1"/>
Where Label1 defaults to "Go"... Label2 defaults to the value in Label1.
Goal is to remove redundancy such as:
<Field Name="State" DataSourceField="State" />
Unfortunately this is not possible, in fact XML Schema provides little or no support for cross-element dependencies (including validation).
精彩评论