The default value of an element is a value constraint [1] which applies to an element if it is empty. It is not substituted in place when such an element is absent.
Thanks.
[1] http://www.w3.org/TR/xmlschema-1/#e-value_constraint
"PHDB _" <[EMAIL PROTECTED]> wrote on 07/21/2004 10:58:44 AM:
> To be more precise in my question, I have just noticed that default values
> are added for elements but only if the element is empty i.e. in my case if I
> have <DateApplication></DateApplication>.
>
> Is it possible to have them even if the tag is not present *AT ALL* ?
>
> Thks
>
>
> >From: "PHDB _" <[EMAIL PROTECTED]>
> >Reply-To: [EMAIL PROTECTED]
> >To: [EMAIL PROTECTED]
> >Subject: Element default values question
> >Date: Wed, 21 Jul 2004 14:10:31 +0000
> >
> >Hi,
> >
> >I have a question about element default values defined in the schema. How
> >can we get them when parsing the file ?
> >
> >I have the foolowing part of a schema
> ><xs:complexType name="TaxData_Type">
> ><xs:complexContent>
> > <xs:extension base="Data_Type">
> > <xs:sequence>
> > <xs:element name="DateApplication" default="TRV" minOccurs="0">
> > <xs:simpleType>
> > <xs:restriction base="xs:string">
> > <xs:enumeration value="SGT"/>
> > <xs:enumeration value="TRV"/>
> > </xs:restriction>
> > </xs:simpleType>
> > </xs:element>
> > </xs:sequence>
> > </xs:extension>
> ></xs:complexContent>
> ></xs:complexType>
> >
> >With TRV as default value in the type, I expected to receive TRV if I don't
> >put a DateApplication tag in TaxData.
> >But I receive nothing :-(
> >
> >http://apache.org/xml/features/validation/schema/element-default is set to
> >true, and so are schema validation and validation features.
> >
> >It doesn't call characters() for DateApplication (I printed it on screen).
> >Any idea ?
> >
> >Additional question : why should it call characters() for element default
> >values, whereas it calls startElement() for attribute default values ?
> >How can we know to which tag the default value sent to characters() refers
> >to ?
> >By the way it works well for attribute default values for me.
> >
> >
> >By the way I'm using the latest Xerces 2_6_2.
> >
> >Many thks in advance,
>
> _________________________________________________________________
> MSN Search, le moteur de recherche qui pense comme vous !
> http://search.msn.fr
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: [EMAIL PROTECTED]
E-mail: [EMAIL PROTECTED]
- Element default values question PHDB _
- RE: Element default values question PHDB _
- RE: Element default values question Neil Delima
- Michael Glavassevich
