In XMLSchema, there is a difference between the element not being there
and the element being present, but with the default value. If your
application needs to perform the same action for both cases, you would
have to code this decision in your application. You can avoid
maintaining a separate default value by using the SchemaType API to get
the default value from Schema.

Radu

On Thu, 2008-02-21 at 05:18 -0800, gennady.shumakher wrote:
> Hi,
> 
> I have a default value specified in the definition of the element. But the
> generated class returns the default value only if the element exists in the
> xml document.
> schema:
> <complexType name="SomeType">
>  <sequence>
>     <element name="name" type="string" minOccurs="1"/> 
>     <element name="interval" type="long" minOccurs="0" default="1000" /> 
> ....
> 
> xml:
> <root>
>   <name>AAA</name>
>   <interval /> 
> ...
> getInterval() returns default value, but if 'interval' node doesn't exists
> in xml (according to minOccurs="0" ) getInterval() returns 0. Is that
> designed behavior?
> 
> Suppose it is. I do have isxxxSpecified() method to determne the existence
> of the element in the document, but whether a way to get programmaticaly the
> default value specified in the schema (to prevent its double maintenance in
> the schema and in the code)?
> 
> Thanks,
> Gennady
> 

Notice:  This email message, together with any attachments, may contain 
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated 
entities,  that may be confidential,  proprietary,  copyrighted  and/or legally 
privileged, and is intended solely for the use of the individual or entity 
named in this message. If you are not the intended recipient, and have received 
this message in error, please immediately return this by email and then delete 
it.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to