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

Groovy Get value of an XML attribute with GPath Slurper

Need to parse an XML document that contains attributes within a header context.
Plasma
  • 2,622
  • 2
  • 20
  • 35
0
votes
2 answers

Groovy: Find nodes in other nodes

I have a problem with finding a good method to handle a xml in a way of finding some nodes in between other nodes. Example: String test = ''' Hello John Doe
Justin Holze
  • 181
  • 1
  • 2
  • 11
0
votes
1 answer

appendNode using xmlSlurper in a specific position

I'm gonna include the xml structure below: @Rao, @tim_yates. The actual xml is: encoded64 text I need to include a new…
Raul Biondo
  • 17
  • 1
  • 8
0
votes
1 answer

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.groovycsv.CsvParser.parseCsv import…
0
votes
0 answers

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 methods to control the order ? Input:
Bhanuchander Udhayakumar
  • 1,581
  • 1
  • 12
  • 30
0
votes
0 answers

Groovy Script with XmlSlurper

I have an XML file that I am trying to parse through with Groovy. server1.me.com TESTING
Ryan Johnson
  • 109
  • 1
  • 2
  • 8
0
votes
3 answers

Retrieve a whole node as a string with XmlSlurper

I want to retrieve the elements of as array of String and I am trying the following: import groovy.util.XmlSlurper def payload = ''' LOG 1 2017-05-18T16:20:00.000 LOG…
Stanislav Ivanov
  • 425
  • 2
  • 7
  • 19
0
votes
1 answer

Using variables as GPath expression in XmlSlurper

Given the following XML document: JOHN DOE With a Groovy script I parse the document like this: def xmlFile = new File("mydocument.xml") def root = new…
Robert Strauch
  • 12,055
  • 24
  • 120
  • 192
0
votes
1 answer

XMLSlurper: No nodes found when using XmlSlurper(false, false)

When I create XMLSlurper without validation and namespace awareness: new XmlSlurper(false, false) I subsequently cannot find any nodes with node.depthFirst().findAll(). The following code illustrates my issue: def xml = '''
KarelHusa
  • 1,995
  • 18
  • 26
0
votes
1 answer

Groovy XmlSlurper replace node with given child node value

I'd be grateful for help with the following problem. (I am new to Groovy, and I can't find any specific examples addressing my issue). Using XmlSlurper I am trying to replace an XML node which has a child with a certain value. For example, I want to…
Rob
  • 145
  • 1
  • 13
0
votes
1 answer

Groovy XmlSlurper with Parallel Operation

I am parsing some rss xml feed and need to expand some urls in the description field. Now my code is written as items.collect { it.description = FullText.expand(it.description) return it } In this case, the urls inside are requested one by…
Hao Tan
  • 1,530
  • 2
  • 13
  • 20
0
votes
1 answer

XmlSlurper in Groovy and SOAPUI - Add new element to random location in xml

I'm creating automated tests with soapui and I need to check what happens when I add new groupingNodes on different positions in xml. I have xml structure similar to this: 1 Node 1
exemplum
  • 115
  • 9
0
votes
2 answers

xmlslurper node remove issues

i have a xml from where i wish to remove few nodes. The idea i used is to run through all the root node children and keep writing to another file those nodes which i dont need to delete. One problem I see is: the node attributes gets reordered in…
Vik
  • 8,721
  • 27
  • 83
  • 168
0
votes
0 answers

Node in the groovy. Could not find matching constructor for: groovy.util.Node(groovy.util.NodeList, java.lang.String)

def xmlRecords = new XmlParser().parseText(peopleString) // println xmlRecords.person.subject_datas println "123" def datas = xmlRecords.person.subject_datas def newNode = new Node(datas, 'subject_data') def newSubNode = new…
0
votes
1 answer

issue in groovy xml value print

i have the xml that looks like
Vik
  • 8,721
  • 27
  • 83
  • 168