Actually, no, it won't. Since there is a difference between an element being 
present with the default value and an element not being present, the behavior 
of xmlBeans is to just not add any elements by itself, without the user 
requesting it explicitly.
I don't understand why you would modify your Schema to add
    ... default="red"
rather than modify your Java code to add
    ... x.addNewColor()

Radu

-----Original Message-----
From: Springer, Ian P. [mailto:[EMAIL PROTECTED]
Sent: Monday, May 23, 2005 8:06 AM
To: dev@xmlbeans.apache.org
Subject: RE: All elements not appearing in the generated XML


Have you tried setting default or fixed values in your schema? e.g.:

<xs:element name="Color" type="xs:string" default="red"/> 
<xs:element name="Color" type="xs:string" fixed="red"/> 

I'm not sure if XMLBeans automatically instantiates subelements that
have default or fixed values, but I would hope that it either
automatically does or provides an option to do so.

Ian

| -----Original Message-----
| From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
| Sent: Sunday, May 22, 2005 3:43 AM
| To: dev@xmlbeans.apache.org
| Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
| Subject: All elements not appearing in the generated XML
| 
| Hi
| 
| We need all the elements that are defined in the XSD to 
| appear in the XML.
| Using xmlBeans we specifically set certain elements  & hence 
| those elements appear in the XML. The elements which are not 
| explicitly set using xmlBeans does not appear in the XML. Is 
| there a way (xsd indicator) in the XSD to enforce a 
| particular element to appear in the XML even if it does not 
| hold any value?
| 
| Could you pls help me on this?
| 
| Regards,
| -----------------------------------------------------------------
| Rajshree Lenin
| Extension : 706.
| ------------------------------------------------------------------
| Important Email Information :- The  information  in  this  
| email is confidential and may  be  legally  privileged. It  
| is  intended  solely for the addressee. Access to  this email 
|  by anyone  else  is  unauthorized.  If you are not the 
| intended recipient, any disclosure, copying, distribution or 
| any action taken or omitted to be taken in reliance on it, is 
| prohibited and may be unlawful. If you are not the intended 
| addressee please contact the sender and dispose of this 
| e-mail immediately.
| 
| 
| ---------------------------------------------------------------------
| To unsubscribe, e-mail: [EMAIL PROTECTED]
| For additional commands, e-mail: [EMAIL PROTECTED]
| 
| 

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


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

Reply via email to