Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.5.7
-
Fix Version/s: 1.6-rc-2, 1.5.8, 1.7-beta-1
-
Component/s: None
-
Labels:None
-
Number of attachments :
Description
NamespaceBuilder does not create child nodes
@Test
void testNamespaceBuilder() {
def n = new Namespace('http://foo/bar')
def builder = new NamespaceBuilder(new NodeBuilder()).namespace(n.uri)
Node node = builder.crap(id:"3") {
bucket(name:"foo")
}
// ** this prints out only the "crap" element, not its child
new XmlNodePrinter().print(node)
// *** fails
assert node[n.bucket][0].@name == 'foo'
}
If I'm not missing something here then the bug is in NamespaceBuidlerSupport (it doesn't do anything with the BuilderSupport instance that you pass into the constructor).
This worked for me building vanilla XML nodes (maybe it deosn't work for some other use case that I'm not aware of - otherwise why was NamespaceBuilder* implemented the way it was in Groovy?):