[Zope3-dev] Re: Proposed widget/schema work for the Rivah sprint
(Thursday and Friday this week)
Florent Guillaume
fg at nuxeo.com
Wed Sep 7 13:12:54 EDT 2005
Jim Fulton wrote:
>> But a schema is useful for more than "specifying the values of an
>> object". All notions of schemas I've encountered (CPS Schemas, XML
>> Schemas, Archetypes) use the schema to constrain or validate an
>> existing object, yes, but also to create new objects from scratch
>> (even in the absence of widgets). Being able to specify initial values
>> is quite important there.
>
> It's not clear to me that XML schemas specify this. I'm quite skeptical
> than they do. (They have this mysterious "initial value" thing that
> I can't make any sense of.) I can't believe that XML schemas deal
> with the history of a document, which would seem necessary to give
> inital value, as we mean it, any meaning.
http://www.w3.org/TR/xmlschema-0/#OccurrenceConstraints (2.2.1) says:
Default values of both attributes and elements are declared using the
'default' attribute, although this attribute has a slightly different
consequence in each case. When an attribute is declared with a default
value, the value of the attribute is whatever value appears as the
attribute's value in an instance document; if the attribute does not
appear in the instance document, the schema processor provides the
attribute with a value equal to that of the 'default' attribute. Note
that default values for attributes only make sense if the attributes
themselves are optional, and so it is an error to specify both a
default value and anything other than a value of 'optional' for 'use'.
An "instance document" is comparable to our object, it is what is being
validated/filled by the processor.
Florent
--
Florent Guillaume, Nuxeo (Paris, France) CTO, Director of R&D
+33 1 40 33 71 59 http://nuxeo.com fg at nuxeo.com
More information about the Zope3-dev
mailing list