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.