Thanks but you talked about unmarshalling.I want to know during marshalling if I want to suppress the blank or unset attributes so that there are no nodes corresponding to them, so what can be done in such a scene.

 

Saurabh

 

-----Original Message-----
From: Arunkumar Soundararajan [mailto:[EMAIL PROTECTED]
Sent: Thursday, December 29, 2005 12:35 PM
To: [email protected]
Cc: Saurabh Agrawal
Subject: Re: [castor-user] JAVA object marshalling supressing some fields.

 

Do this

 

Unmarshaller objUnmarshaller = new

Unmarshaller(ClasstoUnMarshall.class);

 

objUnmarshaller.setMapping(mapping);

objUnmarshaller.setIgnoreExtraElements(true);

objUnmarshaller.setIgnoreExtraAttributes(true);

 

This would avoid the one you asked for.

 

Arun

 

 

 

On Thu, 2005-12-29 at 12:10, Saurabh Agrawal wrote:

> I am using for marshalling my JAVA object. I wanted to ask the

> following thing:

>

>

> My object has 10 fields as part of it. Now suppose if I set values of

> 4 fields and leave rest 6 fields empty. Now I marshal my object.

>

>

> So I think all 10 fields would be there in my XML.4 fields would have

> values and rest 6 fields would be marshaled as empty fields.

>

>

> My Question: Since I am not sure which all values will be set by my

> program, so is there any way out that I can just marshal the values

> which are set and not every fields. I cant mark any field as transient

> because at times this field would be set and at times it wont be.

>

>

> I don’t want any blank fields in my XML.

>

>

> Any help in this regard would be appreciated,

>

>

> Thanks in advance,

>

> Saurabh

>

>

 

Reply via email to