W3C home > Mailing lists > Public > xmlschema-dev@w3.org > April 2001

behavior of default and fixed in attributes and elements

From: Paul Jakubik <pauljakubik@yahoo.com>
Date: Thu, 19 Apr 2001 13:13:14 -0700 (PDT)
Message-ID: <20010419201314.56622.qmail@web11006.mail.yahoo.com>
To: xmlschema-dev@w3.org
(sorry about the subjectless message--resent with
subject)

I am trying to understand what the XML Schema PR has
to say about using default and fixed when specifying
attributes and elements.

This is what I think is true about default and fixed
in attributes (please correct me if I am wrong):
----------------------------------------------------
1)If an attribute has a default value specified, the
attribute's use can not be required. 

2)If the attribute is fixed, then its use may be
required or optional.

3)If the attribute does not appear, the default or
fixed value will be used for that attribute (when
parsing with a validating parser, the parse results
should make it appear that the attribute was provided
and using the default or fixed value).



I am a little more confused with the behavior of
default and fixed for elements, so I have some
questions:
--------------------------------------------------
Q1: The primer says that if a default is provided,
minOccurs must be 0 for that element. I could not find
anything in the structure document that says the same
thing. Could someone point me to the appropriate part
of the PR?

Q2: The default value should be used when the element
is empty. Should the default value also be used when
the element does not appear in the document being
validated?

Q3: If the answer to Q2 is no, then why require
minOccurs to be 0 if a default is specified.

Q4: Does fixed work the same way in elements as it
does in attributes? If a fixed value is specified for
an element, should that value be used if the element
is missing or empty?


If possible I would appreciate it if answers were
accompanied by pointers to sections of the Schema PR
so I can understand the rationale and not just the
answer. Of course just an answer is better than
nothing.

Thanks for the help,

--Paul



__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/
Received on Thursday, 19 April 2001 16:13:34 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:20 GMT