empty tag determination

View: New views
4 Messages — Rating Filter:   Alert me  

empty tag determination

by Peter Hansen-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
hello,
sometimes when I run XStream 1.3.1, I get empty tags like this in my java to xml serialization:
<description></description>
 
At other times, I get them like this:
<description/>
 
I can not see what determines how to write the empty tags. The "description" is a String. Could it be that whitespaces makes the difference?
 
Grateful for any comments.
 
best regards,
Peter

Ready for Fall shows? Use Bing to find helpful ratings and reviews on digital tv's. Click here.

Re: empty tag determination

by Jörg Schaible-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Peter,

Peter Hansen wrote at Dienstag, 22. September 2009 16:15:

>
> hello,
> sometimes when I run XStream 1.3.1, I get empty tags like this in my java
> to xml serialization: <description></description>
>  
> At other times, I get them like this:
> <description/>
>  
> I can not see what determines how to write the empty tags. The
> "description" is a String. Could it be that whitespaces makes the
> difference?
>  
> Grateful for any comments.

It's equivalent. It simply depends on the implementation generating the XML.
IIRC the StAX implementation uses its own XML writer, while most other
drivers use XStream's PrettyPrintWriter.

- Jörg


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

    http://xircles.codehaus.org/manage_email



Re: empty tag determination

by Peter Hansen-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
hi Jörg,
 
joerg.schaible wrote at Tue, 22 Sep 2009 17:01:07:

> It's equivalent. It simply depends on the implementation generating the XML.
> IIRC the StAX implementation uses its own XML writer, while most other
> drivers use XStream's PrettyPrintWriter.

but how does the PrettyPrintWriter decide how to write the empty tag? It does not seem consistent. By all means, this is not a big issue as the two ways to write an empty tag is equivalent, as you wrote. I was just curious on how this can occur as I use the same setup and get two different ways that the empty tag is written. Or do I misunderstand something here?
 
best regards,
Peter


Ready for Fall shows? Use Bing to find helpful ratings and reviews on digital tv's. Click here.

Re: empty tag determination

by Jörg Schaible-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Peter,

Peter Hansen wrote at Mittwoch, 23. September 2009 09:26:

>
> hi Jörg,
>  
>
> joerg.schaible wrote at Tue, 22 Sep 2009 17:01:07:
>
>
>> It's equivalent. It simply depends on the implementation generating the
>> XML. IIRC the StAX implementation uses its own XML writer, while most
>> other drivers use XStream's PrettyPrintWriter.
>
>
> but how does the PrettyPrintWriter decide how to write the empty tag? It
> does not seem consistent. By all means, this is not a big issue as the two
> ways to write an empty tag is equivalent, as you wrote. I was just curious
> on how this can occur as I use the same setup and get two different ways
> that the empty tag is written. Or do I misunderstand something here?

AFAICS PrettyPrintWriter will always write "<tag/>". Do you say, that you
get the different result using the same Driver implementation?

- - Jörg


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

    http://xircles.codehaus.org/manage_email