You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@xerces.apache.org by Wong Kok Wai <wo...@pacific.net.sg> on 2000/02/19 16:42:10 UTC

Question on XMLSerializer

Currently, when an attribute has no value, it is still serialized with
an value of zero-length string. Is this behaviour correct?

I rather think nothing should be serialised is more correct. At least
the document size would be smaller if most of the attributes are not
initialised. With the current behaviour, it also means the resulting
parsed result will have to be checked for zero-length attributes value.




Re: Question on XMLSerializer

Posted by Assaf Arkin <ar...@exoffice.com>.
The serializer gets the attributes from the document (DOM) or events
(SAX), do by definition these attributes exist. They may have any value,
and an empty string is a value.

Since the attribute was obtained from the DOM, you want it to appear in
the document and be brought back to the DOM when the document is parsed
in.

If you do not want the attribute to appear, simply remove it from the
DOM before serializing the document.

arkin


Wong Kok Wai wrote:
> 
> Currently, when an attribute has no value, it is still serialized with
> an value of zero-length string. Is this behaviour correct?
> 
> I rather think nothing should be serialised is more correct. At least
> the document size would be smaller if most of the attributes are not
> initialised. With the current behaviour, it also means the resulting
> parsed result will have to be checked for zero-length attributes value.