[jboss-dev-forums] [Design of JBoss ESB] - Smooks & Groovy mask illegal attribute names
ama1
do-not-reply at jboss.com
Wed Mar 4 05:49:44 EST 2009
Hi Forum,
I try to rename a xml-element with groovy and smooks:
| <g:groovy executeOnElement="csv-record">
| <g:script>
| <!--
| //Rename the target fragment element from "csv-record" to "address"...
| DomUtils.renameElement(element, "address", true, true);
| -->
| </g:script>
| </g:groovy>
|
Problem is that the generated groovy class uses the element-name 'csv-record' as part of an attribute name:
| public void visitAfter(Element element, ExecutionContext executionContext, Writer writer) {
| Element csv-record_Mangled = element;
| Document document = element.getOwnerDocument();
| Map nodeModels = DOMModel.getModel(executionContext).getModels();
|
| def writeFragment = { outNode ->
| if(outNode.getNodeType() == Node.ELEMENT_NODE) {
| Serializer.recursiveDOMWrite((Element) outNode, writer);
| } else if(outNode.getNodeType() == Node.DOCUMENT_NODE) {
| Serializer.recursiveDOMWrite(outNode.getDocumentElement(), writer);
| } else {
| throw new SmooksException("Call to 'writeFragment' with a non Document/Element Node. Node type: " + outNode.getClass().getName());
| }
| }
|
|
|
| //Rename the target fragment element from "csv-record" to "address"...
| DomUtils.renameElement(element, "address", true, true);
|
|
| }
|
Strange is that this attribute is never used. But anyway, is there a way to mask this name??
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4214831#4214831
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4214831
More information about the jboss-dev-forums
mailing list