handle xml empty tag

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

handle xml empty tag

manoj
I have xml with empty tag. while calling below code i am getting conversion
exception.
public static  <T> T xmlToVoConversion(String data ,  Class<T> genericType)
        {
                XStream stream = new XStream( );
                stream.processAnnotations(genericType);
                T convertedObject = (T) stream.fromXML(data);
                logger.info(convertedObject);
                return convertedObject;
        }

I need solution with customer convertor.


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: handle xml empty tag

Jörg Schaible-2
Hi,

manoj wrote:

> I have xml with empty tag. while calling below code i am getting
> conversion exception.
> public static  <T> T xmlToVoConversion(String data ,  Class<T>
> genericType) {
> XStream stream = new XStream( );
> stream.processAnnotations(genericType);
> T convertedObject = (T) stream.fromXML(data);
> logger.info(convertedObject);
> return convertedObject;
> }
>
> I need solution with customer convertor.


It depends completely on the type you're unmarshalling. For some is an empty
value valid, for others it is not.

Cheers,
Jörg


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email