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
2
votes
1 answer

GPath to find if a table header contains a matching string

I'm parsing an HTML file into a well-formed XML document using NekoHTML parser. However I can't quite figure out the GPath so that I can identify the table that has the "Settings" string. def parser = new…
Gaurav
  • 1,466
  • 3
  • 17
  • 24
2
votes
1 answer

XmlSlurper: Changing text in element with namespace

I don't understand why xml."con:cred"."ser:user" = "modified_username" doesn't change the text. Can someone explain this? input = """
shuttle
  • 153
  • 1
  • 11
2
votes
2 answers

how to find offending line when using XmlSlurper

I am parsing a dirty html page with XmlSlurper, and I get the following error: ERROR org.xml.sax.SAXParseException: Element type "scr" must be followed by either attribute specifications, ">" or "/>". at…
Persimmonium
  • 15,593
  • 11
  • 47
  • 78
2
votes
2 answers

Jsoup vs groovy XmlSlurper?

I am looking at parsing some xml content for my application (based on groovy) and I am stuck at this point where I have to choose between JSoup and groovy's native XMLSlurper. RSS Feeds parsed are of medium size not exceeding more than 25 items. So…
Vamsi Emani
  • 10,072
  • 9
  • 44
  • 71
2
votes
2 answers

XmlSlurper.appendNode doesn't change size

I work with XML using XmlSlurper. It works fine until I update it. The appendNode doesn't reflect the size. How to worked with XmlSlurper after structure update? XML definition: def CAR_RECORDS = '''
amra
  • 16,125
  • 7
  • 50
  • 47
2
votes
0 answers

GPathResult to org.w3c.dom.Node

This might be a very simple, but I'll ask anyway. I have the following code that does a post to a web service. I am using HttpBuilder to build the request and post the payload. The method returns a GPathResult that I need to change into a…
Espen Schulstad
  • 2,355
  • 3
  • 21
  • 32
2
votes
1 answer

Unable to add XMLSlurper to Eclipse Groovy project

I want to use XMLSlurper in my Groovy project in Eclipse. I found out that i need to use Groovy-All Jar from https://search.maven.org/search?q=g:org.codehaus.groovy to get those functionalities. After adding them to my Eclipse Project, when i use…
Sourav Das
  • 982
  • 1
  • 15
  • 40
2
votes
1 answer

How to check that a tag contains value or child tag in groovy xmlslurper?

def list=" xx xxxx " (or) def list=" xxxx "; def books=new XMLSlurper(list); I have requirment like if (books.book has value ) do something else if(books.book…
2
votes
3 answers

How to use GPath with variable?

Let's say I have the following XML at hand some value
Yossi Even
  • 45
  • 8
2
votes
1 answer

Groovy: merging two XML files with GPathResult.appendNode(node) does not work

I need to write a script that takes several XML files and performs some operations basing on their contents. To make it easier to go through all the elements I wanted to merge all files into one XML tree (only in memory). I've tried using…
xersiee
  • 4,432
  • 1
  • 14
  • 23
2
votes
1 answer

Jenkins Groovy with XMLSlurper Error "failed to serialize"

I am on Jenksin 2.46.2 and have a job that uses Active Choices Reactive Parameter. I select my servers in my first selection from a XML file using XMLSlurper and reference that for my second selection. When I hardcode the server name the code works…
Ryan Johnson
  • 109
  • 1
  • 2
  • 8
2
votes
1 answer

How to loop over XML child nodes using groovy script

I have an XML response as below:
Kumar
  • 23
  • 1
  • 3
2
votes
0 answers
2
votes
1 answer

Find maximum value of attribute with Groovy XmlSlurper

Given xml: dt
lospejos
  • 1,976
  • 3
  • 19
  • 35
2
votes
2 answers

reading name of json using groovy

I have the below JSON structure and I am trying to retrieve the name order/sale/Cancel to a string variable in groovy {"Transaction" : {"Order" : { ...... {"Transaction" : {"Sale" : { ...... {"Transaction" : {"Cancel" : { ...... I was able to get…
anuj
  • 21
  • 1