Questions tagged [xmlslurper]

XMLSlurper is a Groovy class that makes parsing and working with XML simpler than with Java.

You can read more here

241 questions
0
votes
1 answer

Unable to ammend an XML value in Grails

I'm using Grails 2.5.6 and OpenJDK1.8.0.292. I'm trying to download an XML file from a TFTP server, ammend one of the node values, and then write the ammended file locally. My code looks like :- def xmlFile =…
Simon
  • 97
  • 3
  • 13
0
votes
1 answer

Add new xml nodes dynamically with N number of nested tags

I have the below sample xml. Test@yopmail.com And I want to insert a new set of xml message tags dynamically using groovy as the below 2 samples. For example every message will have the A,B & C tags. But the nested tags…
jdk1.7
  • 166
  • 1
  • 9
0
votes
1 answer

Groovy. Open, Modify and Write xml file

I'm trying to read and change one specific node of a pom.xml using XmlSlurper but I'm unable to change the original file. The original pom.xml: ... something1 something2
0
votes
2 answers

Using xpath on a GPathResult obtained from XmlSlurper.parse()

So, I have this HTML, read programmatically from an email message:
Mike Warren
  • 3,796
  • 5
  • 47
  • 99
0
votes
1 answer

XmlSlurper and http.get in groovy

I first save a txt file using http.get: http.get(path: path, contentType: TEXT, query: [id:dapId, instance:alias, format:'xml', file:portalFile]) {resp, reader -> println "response status:…
SL1
  • 1
0
votes
1 answer

Dynamically parsing of XMLs in Groovy

I have XML with this format: 1 code1 date1 id1
0
votes
1 answer

Nested XML to flat JSON using groovy

I am still new to groovy. I need to create a flat json file from a nested xml file. I am having a hard time accessing the header fields when I try to create the JSON. this is the input:
Eric C.
  • 63
  • 6
0
votes
1 answer

appendNode with namespace in Groovy

I have a follow-up question to this post appendNode using xmlSlurper in a specific position . Is it possible to add the Salutation tag with a namespace, for example, achieve the below output
lm1234
  • 1
0
votes
1 answer

Get href value inside HTML using Groovy

I have JSON response in which there is HTML page. I want to get href value inside HTML page. JSON Response { "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('fbd22ce4-XXXX-4d87-XXXX-6c74983b96fa')/messages(body)", …
rAJ
  • 1,295
  • 5
  • 31
  • 66
0
votes
1 answer

Groovy XMLSlurper update document to match schema

I'm having an issue I can't seem to work my way past and hoping some of you knowledgeable mavens can provide a solution. I have a document with an XSD containing a sequence. As you know, this means that all the elements must appear in the specified…
Mark
  • 1,988
  • 2
  • 24
  • 42
0
votes
1 answer

decode single base64 lines from an XML document with xml SLuper

I am trying to decode an XML document that has lines that are base64 encoded. For this I first tried to read the XML document with XML Slurper and then convert it line by line and write all lines into a string. Unfortunately I didn't manage to…
0
votes
2 answers

How to dynamically create an XML object in the jmeter PreProcessor

Using Jmeter, I want to compose a dynamically-sized, XML object with dynamically-generated content having the structure as the one below in a JSR223 preprocessor:
JustNatural
  • 375
  • 7
  • 19
0
votes
1 answer

How can I select the root value of a node not including its children?

I need to access the new value for each field if it exists, and the "previous" value in order to determine if a record has a change. Sample XML Payload 8675309
NDBoost
  • 10,184
  • 6
  • 53
  • 73
0
votes
1 answer

How to find all elements by a tag and attribute in Groovy using XmlSlurper

We have a xml which looks like below
user3540481
  • 221
  • 3
  • 13
0
votes
1 answer

Parent node in Groovy XmlSlurper

I am using Groovy / XmlSlurper to read parent nodes of an XML document, for example the following program: import groovy.xml.* def text = ''' Don…</div> <div class="grid ai-start jc-space-between fw-wrap"> <div class="grid gs4 fw-wrap tags "> <a href="../../questions/tagged/xml" class="post-tag grid--cell" title="show questions tagged 'xml'" rel="tag">xml</a> <a href="../../questions/tagged/groovy" class="post-tag grid--cell" title="show questions tagged 'groovy'" rel="tag">groovy</a> <a href="../../questions/tagged/xmlslurper" class="post-tag grid--cell" title="show questions tagged 'xmlslurper'" rel="tag">xmlslurper</a> </div> <div class="started mt0"> <div class="s-user-card s-user-card"> <time class="s-user-card--time" datetime="asked Jun 27 '21 at 10:49">asked Jun 27 '21 at 10:49</time> <a href="../../users/2288349/user2288349" class="s-avatar s-avatar__32 s-user-card--avatar"> <img class="s-avatar--image" src="../../users/profiles/2288349.webp" data-jdenticon-width="32" data-jdenticon-height="32" data-jdenticon-value="user2288349" /> </a> <div class="s-user-card--info"> <a href="../../users/2288349/user2288349" class="s-user-card--link">user2288349</a> <ul class="s-user-card--awards"> <li class="s-user-card--rep" title="reputation score">267</li> <li class="s-award-bling s-award-bling__silver" title="2 silver badges">2</li> <li class="s-award-bling s-award-bling__bronze" title="12 bronze badges">12</li> </ul> </div> </div> </div> </div> </div> </div> </div> <div class="s-pagination pager fr"> <a class="s-pagination--item" href="../../questions/tagged/xmlslurper_page=9" rel="prev" title="Go to page 9">Prev </a> <a class="s-pagination--item" href="../../questions/tagged/xmlslurper_page=1" rel="" title="Go to page 1">1</a> <a class="s-pagination--item" href="../../questions/tagged/xmlslurper_page=2" rel="" title="Go to page 2">2</a> <a class="s-pagination--item" href="../../questions/tagged/xmlslurper_page=3" rel="" title="Go to page 3">3</a> <div class="s-pagination--item s-pagination--item__clear">…</div> <a class="s-pagination--item" href="../../questions/tagged/xmlslurper_page=16" rel="" title="Go to page 16">16</a> <a class="s-pagination--item" href="../../questions/tagged/xmlslurper_page=17" rel="" title="Go to page 17">17</a> <a class="s-pagination--item" href="../../questions/tagged/xmlslurper_page=11" rel="next" title="Go to page 11"> Next</a> </div> </div> </div> </div> </div> <script src="../../static/js/stack-icons.js"></script> <script src="../../static/js/fromnow.js"></script> </body> </html>