Details
-
Type: Bug
-
Status: Closed
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 1.x Maintenance
-
Component/s: None
-
Labels:None
Description
Dom4JWriter.addAttribute work incorrect, see attached test case.
I want:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<A attrA="valA"/>
<B attrB="valB"/>
<C attrC="valC"/>
</root>
but with code:
StringWriter stringWriter = new StringWriter();
XMLWriter writer = new XMLWriter(stringWriter);
Dom4JWriter dom4JWriter = new Dom4JWriter(writer);
dom4JWriter.startNode("root");
dom4JWriter.startNode("A");
dom4JWriter.addAttribute("attrA", "valA");
dom4JWriter.endNode();
dom4JWriter.startNode("B");
dom4JWriter.addAttribute("attrB", "valB");
dom4JWriter.endNode();
dom4JWriter.startNode("C");
dom4JWriter.addAttribute("attrC", "valC");
dom4JWriter.endNode();
dom4JWriter.endNode();
I get:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<A attrA="valA"/>
<B attrA="valA" attrB="valB"/>
<C attrA="valA" attrB="valB" attrC="valC"/>
</root>
I assume that "attributes.clear();" is necessary in Dom4JWriter.endNode() after "writer.write(element);" for correct working.
Issue Links
- is duplicated by
-
XSTR-351 XStream with Dom4J driver fail to handle self object reference
Fixed in Subversion.