Community
Participate
Working Groups
1. sapphire-gallery.xml -> Element Properties -> Homogeneous -> select "Include child element" 2. deselect "Include child element" 3. Go to source and notice the following still in source code. <homogeneous> </homogeneous> Same issue with the heterogeneous element properties.
There may be cases where this is desired (such as implied element properties), but we will not in general remove empty parent elements when content is deleted. Before we can remove an element, we need to know that its presence doesn't carry semantic information. In the sited cases, the bindings are defined as follows: @XmlElementBinding( path = "homogeneous", mappings = @XmlElementBinding.Mapping( element = "child", type = IChildElement.class ) ) @XmlElementBinding ( path = "heterogeneous", mappings = { @XmlElementBinding.Mapping( element = "child", type = IChildElement.class ), @XmlElementBinding.Mapping( element = "child-with-integer", type = IChildElementWithInteger.class ), @XmlElementBinding.Mapping( element = "child-with-enum", type = IChildElementWithEnum.class ) } ) In these cases, we do know that element specified in the path attribute ("homogeneous" and "heterogeneous") are just structural and do not carry semantic information. They are created as necessary and the can be deleted if empty. Targeting to 0.3 for now in order to review cases.
This was already implemented for value and list property bindings, but element property bindings (implied and explicit) weren't acting in the same manner. Fixed that. Please verify.
Verified with sapphire-gallery.xml and the coherence use case.
The fix causes a regression when the model element only contains xml attributes. For example, the following generated xml: <?xml version="1.0" encoding="UTF-8"?> <adfc-config xmlns="http://xmlns.oracle.com/adf/controller" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.oracle.com/adf/controller http://xmlns.oracle.com/adf/controller/1.0"> <task-flow-definition id="task-flow-definition"> </adfc-config> becomes: <?xml version="1.0" encoding="UTF-8"?> <adfc-config xmlns="http://xmlns.oracle.com/adf/controller" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.oracle.com/adf/controller http://xmlns.oracle.com/adf/controller/1.0"> </adfc-config> Using the same code snippet: XmlResourceStore xmlStore = new XmlResourceStore( new WorkspaceFileResourceStore(taskFlowFile)); IADFController controller = IADFController.TYPE.instantiate(new RootXmlResource(xmlStore)); controller.getTaskFlow().setTaskFlowId(id); xmlStore.save();
Fixed the issue with attributes. TestXmlBinding0008 now covers this scenario, including the attributes corner case. Please re-verify the original scenarios too.
I've verified with my use case.
Verified with sapphire-gallery.xml and the coherence use case again.