Skip to content

StAXDocumentSerializer.writeEndDocument() don't close elements correctly #47

Description

@Tomas-Kraus

In StAXDocumentSerializer.writeEndDocument() there is a piece of code that try to close elements that are not closed :

for(;_stackCount >= 0; _stackCount--) {
writeEndElement();
}

This code is wrong because _stackCount is decremented twice : in the for block and in writeEndElement().
Also, it doesn't manage well a single writeEmptyElement("x") in the document.

A solution should be :

if (_isEmptyElement) encodeTerminationAndCurrentElement(true);
while (_stackCount >= 0) writeEndElement();

Affected Versions

[current]

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions