Skip to main content
Filter by
Sorted by
Tagged with
0 votes
1 answer
72 views

Groovy Sql resultSet rendering to XML via MarkupBuilder

I am trying to generate XML output in Groovy (4.0.18) from generic SQL requests where the query is provided at runtime. So I have captured the SQL results in a List (of ResultSets) and I captured the ...
H. Dog's user avatar
  • 337
1 vote
1 answer
34 views

MarkupBuilder - Generate attributes without encapsulation

Is it possible to generate attributes using MarkupBuilder() without encapsulating it. I have the following: def writer = new StringWriter() def xml = new MarkupBuilder(writer) // generate strings ...
laloune's user avatar
  • 673
0 votes
1 answer
84 views

Groovy Markup-Builder use dynamic node name

I want to create a XML with the Markup-Builder in Groovy. I have the following XML in my program: <root> <row> <first-name>Max</first-name> <last-name>...
Sebi's user avatar
  • 3,969
1 vote
0 answers
101 views

Groovy throws error when "_-"are being used before root node while generating XML using XML markup builder .How to resolve it

While generating an XML from JSON I need to use "_-"before root node name due to naming convention rules but MarkupBuilder throws an error in groovy scripting. How can I resolve it? input is ...
Yalamati hemanth kumar's user avatar
1 vote
1 answer
61 views

passing in args to a Closure for a StreamingMarkupBuilder

Groovy 2.4, Spring 5.3.13 Not having much luck using StreamingMarkupBuilder to create some XML, serialize it and print it public void createMsgToStreamOut( String strCreatedAt, String strEntity, ...
code_warrior's user avatar
0 votes
1 answer
217 views

Create XML object with dynamical content from a source CSV file

I have the following CSV file: iDocType,iDocId,iName,iDate P,555551555,Braiden,2022-12-31 I,100000001,Dominique,2024-12-10 P,100000002,Joyce,2025-11-15 Using jmeter's JSR223 preprocessor element, I ...
JustNatural's user avatar
1 vote
1 answer
972 views

Using Groovy markupbuilder to build simple web page. No such DSL method 'body' found among steps

I am trying to build a simple webpage using HTML markup but I get the error: java.lang.NoSuchMethodError: No such DSL method 'body' found among steps Code: @NonCPS def parseJsonForXml(inputJson) { try ...
Gary Toms's user avatar
0 votes
1 answer
902 views

Iterate over Json map, create html table with embedded links

I'm reviewing an XML markupbuilder script that iterates through a json array (data from which is pulled from an external api) and displays the data in as an HTML table as follows: import groovy.json....
Ian Balas's user avatar
2 votes
1 answer
685 views

Generate CDATA in XML using groovy MarkupBuilder

I want to be able to generate a CDATA portion in my XML using Groovy. I have used the mkp of the MarkupBuilder to do that, but it's not working. I am looping through products and then generate the ...
BreenDeen's user avatar
  • 728
0 votes
1 answer
610 views

How to convince groovy.xml.MarkupBuilder to create a node whose name is 'use'

SVG defines an element named use and I am trying to generate an SVG file using groovy.xml.MarkupBuilder that takes advantage of this tag: http://tutorials.jenkov.com/svg/defs-element.html def writer ...
spierepf's user avatar
  • 2,896
0 votes
1 answer
48 views

how to create Gsp tag by Markupbuilder?

I want to create a gsp file like this: but I fail to find how to write the code by markupbuilder. my code like this: MarkupBuilder mb = new groovy.xml.MarkupBuilder(strXml); def ...
user1436285's user avatar
1 vote
1 answer
183 views

Using a taglib tag with MarkupBuilder

I try to call a Grails Tablib in combination with the Groovy MarkupBuilber MarkupBuilder html = new MarkupBuilder(out) html.div { g.link(controller: "...", action: "...") { ... } } ...
Andreas's user avatar
  • 400
0 votes
1 answer
83 views

Groovy MarkUpBuilder with local files

Im little stuck with XML. Path in sqlfile in XML must be taken from folders where are SQLfiles loaded by using dir and dir1 I have problem to build XML like that : <databaseChangeLog <...
John Doe's user avatar
  • 147
0 votes
1 answer
192 views

why groovy each function not iterating while inside another one

why groovy .each function is only one time iterating while it lies inside another one iteration like shown below code ? Code: @Grab('com.xlson.groovycsv:groovycsv:1.1') import static com.xlson....
Bhanuchander Udhayakumar's user avatar
0 votes
0 answers
193 views

why xml node attributes order changes after parsing with XmlSlurper?

The order of the attributes changes of using XmlSlurper. Why it changes ? We know that it doesn't affect the xml grammar. Even Is there any methods to keep the order as it is (or) Is there any ...
Bhanuchander Udhayakumar's user avatar
0 votes
1 answer
97 views

How to print plain content at the end of node using groovy MarkupBuilder?

I'm trying to implement a simple breadcrump in grails. I'm using taglib + Groovy MarkupBuilder. I'm use font-awesome too. So, my problem is I want to put the text 'PROBLEM' after the icon. My code ...
ricardogobbo's user avatar
  • 1,740
0 votes
1 answer
930 views

add some declaration line to the xml file with the aid of MarkupBuilder

I am trying to build a xml file with the MarkupBuilder with some declarations and tags but I do not find a solution to build the following line <kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx=...
TheBook's user avatar
  • 1,708
1 vote
1 answer
193 views

call function during xml traversal in groovy

I transform one xml to another and I am not able to call function defined on script level from closure which used to process node from input xml. See example code def xml = new MarkupBuilder() def ...
Martin Barnas's user avatar
4 votes
2 answers
1k views

Want Groovy MarkupBuilder() Equivalent to JSONBuilder() for Objects

Goal: Given the myInfoObject definition below, I wish to be able to do this: println new groovy.xml.MarkupBuilder(myInfoObject).toPrettyString() Premise: The following is one of the most amazing and ...
solvingJ's user avatar
  • 1,359
1 vote
0 answers
751 views

Refactoring groovy html markupbuilder

I picked up groovy scripting recently so I'm still a beginner in it (I'm also a professional programmer in C with some notions of Java) I successfully created a valid html page with the MarkupBuilder ...
CMFR's user avatar
  • 21
1 vote
1 answer
2k views

create xml markupBuilder based on external variables

I have seen in plenty of websites the common use of MarkupBuilder xml creator. For example: def xmlWriter = new StringWriter() def xmlMarkup = new MarkupBuilder(xmlWriter) xmlMarkup.movie(id: "2", "...
egorive's user avatar
  • 13
0 votes
2 answers
532 views

How to add &#xA; after text in XML element in Groovy MarkupBuilder

Basically we are changing the datasource XML for an InDesign project the way the old. We don't want to change the InDesign so I have to adapt the new XML from the new datasource (a SOAP webservice via ...
Paperbag Writer's user avatar
0 votes
1 answer
415 views

groovy markup java.lang.Exception: No method named issue

Good day. I am working on this groovy script import groovy.xml.MarkupBuilder; import groovy.xml.*; def writer = new StringWriter(); def xmlResponse = new MarkupBuilder(writer); def index = 0; ...
cnabiong's user avatar
1 vote
2 answers
270 views

XML marshalling of nested elements in Grails using Groovy markup builder syntax

Grails: v2.5.0 How can I generate XML including nested elements without attributes? This is my desired output: <?xml version="1.0" encoding="UTF-8"?> <list> <book> <title&...
user avatar
0 votes
1 answer
146 views

How to format data in when defining XML in groovy?

I'm quite new to Groovy and couldn't find the right way to format/edit data in groovy when defining xml. I'd like to format my date to some custom format but I can't call any method from inside this ...
Asyla's user avatar
  • 1
0 votes
1 answer
106 views

Create XML based on class hierarchy

My code is as follows: class GlobalInfo { // multiple properties here String name; GlobalInfo parent; static hasMany = [children: GlobalInfo] } class RegionalInfo extends GlobalInfo {...
user avatar
0 votes
2 answers
693 views

Unable to iterate JSON map using Groovy on Mule payload

I have trouble iterating the JSON (map) in my Groovy script, here's the details to my question. In Mule I am receiving a JSON. Here it is : { "order": { "ContactId": "112", "...
Paperbag Writer's user avatar
0 votes
0 answers
294 views

Groovy StreamingMarkupBuilder:: Evaluate before bind

I am generating XML using StreamingMarkupBuilder. I am trying to account for scenarios were there are errors in my data, resulting in NullPointerException. This is how my data is built up currently: ...
Giannis's user avatar
  • 5,486
3 votes
1 answer
1k views

How to add nodes under to different parents in Groovy Markup Builder by calling a method or closure

I would like to produce below xml. I do not want to add xsv block inside xpm and MyRoot by repeating the same code.Instead I want to call a method or closure so that It will return xsv block which can ...
Jeyaganesh's user avatar
0 votes
0 answers
93 views

Only print opening in Groovy MarkupBuilder

I have code like the following public String printHeader(){ println "<html><head>...</head><body><table>" } public String doMiddleStuff(blahblah){ println <...
Steve's user avatar
  • 4,681
2 votes
1 answer
2k views

Groovy MarkupBuilder - not yielding raw text

I have the following chunk of code for writing out a series of button elements, containing an icon and text: def tagcloud = { attrs, body -> def mb = new MarkupBuilder(out) mb.ul('class':...
cweston's user avatar
  • 11.6k
1 vote
1 answer
532 views

Groovy MarkupBuilder passing string by reference

Doing transformation of a JSON feed to a format that can be consumed by our Endeca Instance, and settled on writing this transformation in Groovy, due to tools like JsonSlurper and MarkupBuilder. Our ...
LordJosh's user avatar
0 votes
3 answers
2k views

Groovy MarkupBuilder

I have a list of things, each of which might be a foo or a bar. I want to build some xml that looks like this: <rdf:RDF> <foo id="1"> <foo id="2"> <bar id="3"> </rdf:...
PaulMurrayCbr's user avatar
2 votes
1 answer
2k views

Calling a method from inside StreamingMarkupBuilder

I'm using Groovy's StreamingMarkupBuilder to generate XML dynamically based on the results of a few SQL queries. I'd like to call a method from inside of the closure but the markup builder tries to ...
blacktide's user avatar
  • 12k
0 votes
1 answer
2k views

Using external string variable with Groovy Markup Builder

I have created a string variable using some logic in groovy which reflects the braket syntax in markup builder but the problem is that you are obviously not allowed to use this string in markup ...
user3437621's user avatar
0 votes
1 answer
1k views

Groovy markup builder replace the root

import groovy.xml.MarkupBuilder class XmlTest { static void main(def args) { def XmlTest s = new XmlTest() s.xmlTest() } def xmlTest() { def xml = new ...
user1227299's user avatar
2 votes
2 answers
1k views

Why does StreamingMarkupBuilder perform better than MarkupBuilder for writing large documents

I've read in several places that StreamingMarkupBuilder is better suited to writing large XML documents than MarkupBuilder. However, I've been unable to find a definitive answer as to why that is. ...
Jeremy Jarrell's user avatar
1 vote
1 answer
785 views

Groovy markupBuilder updating parent node

I'm building xml using MarkupBuilder and wonder how can I update a parent attribute when creating a child node. Assuming the number of child elements cannot be calculated when building the parent ...
Tal's user avatar
  • 194
12 votes
2 answers
14k views

Adding multiple XML elements/containers dynamically using XML MarkupBuilder in Groovy

I am trying to generate XML using Groovy MarkupBuilder. XML needed is of this form (simplified): <Order> <StoreID /> <City /> <Items> <Item> <...
CodeVenture's user avatar
1 vote
1 answer
1k views

StreamingMarkupBuilder.out evaluates 'it' as a namespace prefix

I'm trying to generate a pom from custom Artifact groovy class using the following code: def outputBuilder = new StreamingMarkupBuilder() List<Artifact> artifacts = [] artifacts <&...
Ori Dar's user avatar
  • 19k
1 vote
1 answer
2k views

groovy-wslite markupbuilder weired namespacing issue in soap-client

please help, i have a problem with the markupbuilder with groovy. WORKING SOAP REQUEST against endpoint MYENDPOINT and the action MYACTION: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap....
Booyeoo's user avatar
  • 583
-1 votes
1 answer
2k views

Groovy. Appending nodes while using MarkupBuilder and XMLSlurper

My question is with Groovy and appending a node while using MarkupBuilder and XMLSlurper. Can someone tell me why when I run this code up to the first println my output shows the target-line as: <...
kbhuffaker's user avatar
7 votes
2 answers
7k views

How to use Groovy XML MarkupBuilder to create valid HTML script tags?

I am using Groovy 1.8 XML MarkupBuilder to build an HTML page which includes a <script> tag. When I load the page in Firefox 18 I see a blank page instead of the expected results. This seems ...
m0j0hn's user avatar
  • 572
2 votes
2 answers
2k views

Groovy's MarkupBuilder exception on generating "id" XML tag

I'm trying to construct a XML feed, and Groovy's MarkupBuilder is giving me headaches: def newsstandFeed(def id) { def publication = Publication.get(id) def issues = issueService....
thomers's user avatar
  • 2,683
1 vote
2 answers
5k views

Generating nested XML using MarkupBuilder or StreamingMarkupBuilder

I've got a grouped query that results in a list of clinics. Within the clinics are patients. And within the patients are prescriptions. I'm trying to output this structure using MarkupBuilder, but ...
Lee Grey's user avatar
  • 323
3 votes
1 answer
4k views

Groovy: copy XML elements from one doc to another

I am new to Groovy and am stuck with a simple problem. All I wanna do is extract certain elements from one XML file and created a new file with it. Here's an example XML, let's use a Maven pom file: &...
Jonas's user avatar
  • 860
11 votes
1 answer
7k views

Adding dynamic elements and attributes to groovy MarkupBuilder or StreamingMarkupBuilder [closed]

I've seen many example using Groovy's MarkupBuilder for building an XML document, but they all seem to use static attributes for every element in the document (the attribute names are all known at ...
pneumee's user avatar
  • 113
5 votes
1 answer
2k views

Groovy MarkupBuilder name conflict

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/...
James Watkins's user avatar
2 votes
1 answer
524 views

Creating <use> tag with StreamingMarkupBuilder

I am using StreamingMarkupBuilder to produce XML and I need to have a tag. Unfortunately I get exception : Caught: java.lang.ClassCastException: java.util.LinkedHashMap cannot be cast to java.lang....
wonglik's user avatar
  • 1,069
0 votes
1 answer
5k views

How do I quickly print a groovy.util.slurpersupport.Node?

Is there an easy way to convert a groovy.util.slurpersupport.Node to a groovy.util.Node? I am trying to use the XmlNodePrinter on a node coming from an XmlSlurper, for some quick debugging. Here is ...
GreenGiant's user avatar
  • 5,196