Forum Discussion
SmartBear_Suppo
16 years agoSmartBear Alumni (Retired)
Hi Gregory,
You're on the right path...
The next problem you're trying to solve is not specific to creating XML from Groovy nor Groovy language itself. Rather, it's a more general programming problem: how do I detect groups of parameter name-value pairs that are contained within a greater set of name-value pairs with repeated parameter names?.
As an easy way to carry on I would suggest using a syntax like:
and then parsing the parameter name to extract the message number, detect when you need to output a complete element (using groovy.xml.MarkupBuilder#createNode) and start parsing new message's fields. Clearly, in this approach you would need to keep single message's fields one next to another but since the input file is under your control, that won't pose a problem. There are many ways to parse text in Java/Groovy so that should be a lesser problem for you now.
Good luck!
Cheers!
/Nenad Nikolic a.k.a. Shonzilla
You're on the right path...
The next problem you're trying to solve is not specific to creating XML from Groovy nor Groovy language itself. Rather, it's a more general programming problem: how do I detect groups of parameter name-value pairs that are contained within a greater set of name-value pairs with repeated parameter names?.
As an easy way to carry on I would suggest using a syntax like:
message1.field1=1
message1.field2=2
message1.field3=3
message2.field1=4
message2.field2=5
message2.field3=6
and then parsing the parameter name to extract the message number, detect when you need to output a complete
Good luck!
Cheers!
/Nenad Nikolic a.k.a. Shonzilla
Related Content
- 4 years agokrasnoludpauli