Skip to content

Empty simple content elements still serialized with explicit closing tag #1

@boris-kolpackov

Description

@boris-kolpackov

For example, an empty instance of:

<xs:element name="amount" type="xs:string"/>

Still gets serialized as:

<amount></amount>

This is handled in genx, specifically, genxEndElement(). Currently, it immediately closes the tag if the state is EQUENCE_START_TAG or
SEQUENCE_ATTRIBUTES but not if it's SEQUENCE_CONTENT. Doesn't feel like fixing this at this level will be straightforward, unless we ignore empty content in genxAddText() and similar. But that feels a bit too drastic (this could also be viewed as a feature: if I write content, even empty, I get explicit closing tag).

Alternatively, we could try to handle it at the XSD/e level by not calling genxAddText() for empty simple content.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions