Help with Default please

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