You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by riya <ra...@gmail.com> on 2009/03/02 22:32:17 UTC

XMLBean usage issues

Hi, 

We are using xml beans to generate certain xmls. 
I noticed that when we don't have any values to populate for some tags,  --
xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" -- gets
inserted. 

For eg: I took following tags from one of the xml's generated this way. 

<COMPTIA_CODE xsi:nil="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchemainstance"/>
<AGREEMENT_CODE/>
<PART_NUM xsi:nil="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
<COD_REQ xsi:nil="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>

My requirement is instead of getting: 

<COD_REQ xsi:nil="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>

I should just get: 

<COD_REQ/>

Please advise. 

Thanks In advance!
-- 
View this message in context: http://www.nabble.com/XMLBean-usage-issues-tp22296981p22296981.html
Sent from the Xml Beans - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org


Re: XMLBean usage issues

Posted by Radu Preotiuc <ra...@oracle.com>.
Hi,

Since XMLSchema can represent both nilled and empty elements, we have
decided to model that in XMLBeans too. If you want a "nilled" element
(xsi:nil="true"), then you call the respective setter with "null" as
parameter. If you want to remove an element, use unset.

Radu

On Mon, 2009-03-02 at 16:32 -0500, riya wrote:
> Hi,
> 
> We are using xml beans to generate certain xmls.
> I noticed that when we don't have any values to populate for some tags,  --
> xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" -- gets
> inserted.
> 
> For eg: I took following tags from one of the xml's generated this way.
> 
> <COMPTIA_CODE xsi:nil="true"
> xmlns:xsi="http://www.w3.org/2001/XMLSchemainstance"/>
> <AGREEMENT_CODE/>
> <PART_NUM xsi:nil="true"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
> <COD_REQ xsi:nil="true"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
> 
> My requirement is instead of getting:
> 
> <COD_REQ xsi:nil="true"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
> 
> I should just get:
> 
> <COD_REQ/>
> 
> Please advise.
> 
> Thanks In advance!
> --
> View this message in context: http://www.nabble.com/XMLBean-usage-issues-tp22296981p22296981.html
> Sent from the Xml Beans - User mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
> For additional commands, e-mail: user-help@xmlbeans.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org