markupbuilder

Groovy MarkupBuilder name conflict

不打扰是莪最后的温柔 提交于 2019-11-28 13:46:55
I have this code: String buildCatalog(Catalog catalog) { def writer = new StringWriter() def xml = new MarkupBuilder(writer) xml.catalog(xmlns:'http://www.sybrium.com/XMLSchema/NodeCatalog') { 'identity'() { groupId(catalog.groupId) artifactId(catalog.artifactId) version(catalog.version) } } return writer.toString(); } It produces this xml: <catalog xmlns='http://www.sybrium.com/XMLSchema/NodeCatalog'> <groupId>sample.group</groupId> <artifactId>sample-artifact</artifactId> <version>1.0.0</version> </catalog> Notice that the "identity" tag is missing... I've tried everything in the world to

Groovy MarkupBuilder name conflict

前提是你 提交于 2019-11-27 07:54:52
问题 I have this code: String buildCatalog(Catalog catalog) { def writer = new StringWriter() def xml = new MarkupBuilder(writer) xml.catalog(xmlns:'http://www.sybrium.com/XMLSchema/NodeCatalog') { 'identity'() { groupId(catalog.groupId) artifactId(catalog.artifactId) version(catalog.version) } } return writer.toString(); } It produces this xml: <catalog xmlns='http://www.sybrium.com/XMLSchema/NodeCatalog'> <groupId>sample.group</groupId> <artifactId>sample-artifact</artifactId> <version>1.0.0<