Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty XML elements should be represented by empty strings/collections #381

Closed
RikkiGibson opened this issue Feb 15, 2018 · 2 comments
Closed
Assignees

Comments

@RikkiGibson
Copy link
Member

A payload like this:

<Root>
    <Child>
        <Item>1</Item>
        <Item>2</Item>
        <Item>3</Item>
    </Child>
</Root>

causes the Root.Child property to be a List instance with 3 items.

<Root>
    <Child />
</Root>

causes the Root.Child property to be null.

Similarly, a missing String property/attribute is represented as null. Objects containing unnecessarily null collections are a pain in the butt to use. We should see if we can make them empty by default instead.

@RikkiGibson
Copy link
Member Author

Note FasterXML/jackson-dataformat-xml#124
There might be some reasonably elegant workaround-- worse case we can change model generation again to accommodate.

@rickle-msft
Copy link

Consider support for the case where the child list is not actually included as an element, so
</Root> would still put an non-null empty list in Root.Child even though no child element is even included.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants