W3C home > Mailing lists > Public > xmlschema-dev@w3.org > July 2002

Help with Default please

From: Gary Cramblitt <garycramblitt@comcast.net>
Date: Sun, 14 Jul 2002 20:05:25 -0400
To: xmlschema-dev@w3.org
Message-id: <3D31D985.11948.1705CDF@localhost>

I want to define an element in such a way that the default is applied 
whether the instance document specifies the element or not.

If an instance document does not specify element foo, then the 
post-validation DOM will contain the element with value "bar".  If 
the instance document specifies the element, but leaves the 
contents blank, i.e.,

  <foo></foo>

then the post-validation DOM will also contain the element with 
value "bar".  If user specifies a value, 

  <foo>yea</foo>

that value appears in the post-validation DOM.

I think what I want for my XML-Schema is

<xs:element name="foo" minOccurs="0" maxOccurs="1" 
default="bar"/>

Is this correct?

--
Gary Cramblitt
garycramblitt@comcast.net
Received on Sunday, 14 July 2002 20:11:06 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:55:57 UTC