You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unfortunately, the CopyablePlugin does not copy empty lists. This behavior may lead to invalid XML, if the XML Schema specifies a mandatory attribute (use="required") of list type with no restriction on the list's size - i.e., an XML document with the attribute being present but empty validates successfully, while an XML dockument lacking the attribute fails validation against the schema.
As the CopyablePlugin does not copy empty attributes, a valid XML document (with an empty attribute of list type) becomes invalid when unmarshalled, copied, and marshalled again.
AFAIU, the problem originates from the implementation of jaxb-ri's AbstractListField.Accessor.hasSetValue(). This is used twice in jaxb-tools:
and indirectly via PropertyFieldAccessor#toRawValue (lines 219 and 223)
I do understand that lists of XML elements do not have the same problem (empty lists and "null" lists of XML elements are indistinguishable). So this problem really only applies to lists in XML attributes.
I would be interested to hear your opinion. Do you follow my argument that this is a bug? How could this be solved? Should lists from XML elements be treated differently than lists from XML attributes? If so, what could be done to achieve this?
Thanks in advance!
The text was updated successfully, but these errors were encountered:
Cf. related issue eclipse-ee4j/jaxb-ri#1823
Unfortunately, the CopyablePlugin does not copy empty lists. This behavior may lead to invalid XML, if the XML Schema specifies a mandatory attribute (
use="required"
) of list type with no restriction on the list's size - i.e., an XML document with the attribute being present but empty validates successfully, while an XML dockument lacking the attribute fails validation against the schema.As the CopyablePlugin does not copy empty attributes, a valid XML document (with an empty attribute of list type) becomes invalid when unmarshalled, copied, and marshalled again.
AFAIU, the problem originates from the implementation of jaxb-ri's
AbstractListField.Accessor.hasSetValue()
. This is used twice in jaxb-tools:I do understand that lists of XML elements do not have the same problem (empty lists and "null" lists of XML elements are indistinguishable). So this problem really only applies to lists in XML attributes.
I would be interested to hear your opinion. Do you follow my argument that this is a bug? How could this be solved? Should lists from XML elements be treated differently than lists from XML attributes? If so, what could be done to achieve this?
Thanks in advance!
The text was updated successfully, but these errors were encountered: