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
1
vote
1 answer

meta programming XMLSlurper results

I've Slurped up a twitter feed where each entry looks like: tag:search.twitter.com,2005:30481912300568576 2011-01-27T04:27:08Z
Steve
  • 1,457
  • 12
  • 25
1
vote
1 answer

Is it possible to parse a text file containing XML-like string using XmlSlurper in Groovy?

I have a method readFileContent which will take an XML file as an input and read the content of the XML file and then outputs a String of XML-like data. Now, this XML-like String will be the input parameter of another method extractActualData that…
abhi17
  • 33
  • 6
1
vote
2 answers

Groovy: Index of a node

I have a problem with finding a good method to handle a xml in a way of finding the index of a node. Example: String test = ''' Hello John Doe 2008
Justin Holze
  • 181
  • 1
  • 2
  • 11
1
vote
1 answer
1
vote
1 answer

Groovy: How to check multiple tag value in xml?

I have xml content like this:
2017-10-07 2017-02-02 2017-03-02
Sagitarius
  • 353
  • 1
  • 4
  • 20
1
vote
1 answer

Manipulating XML in Gradle/Groovy with new 'file' node

I am trying to manipulate a wildfly 10.1. standalone.xml via gradle buildscript to modify logger settings. I have done this before, and with logger entries, this works as expected. However, now I need to add a new periodic-rotating-file-handler…
1
vote
2 answers

Groovy XMLSlurper Parse Values

I am so close to getting my code completed. I would like to get only the values in an array. Right now I am getting XML declaration plus the line. Here's my code: import groovy.xml.XmlUtil def serverList = new…
Ryan Johnson
  • 109
  • 1
  • 2
  • 8
1
vote
1 answer

Finding XML element from RESTClient with XMLSlurper

I'm writing a Spock test, in which I have a REST web service that returns an XML like this: USER template111
Alex
  • 228
  • 1
  • 10
1
vote
1 answer

XmlSlurper Issue while Parsing

I have XML as below,
50

Woodstock, VA

Woodstock Square
467…
prostý člověk
  • 909
  • 11
  • 29
1
vote
2 answers

Groovy XMLSlurper - searching sepecific node

I need to find a specific node with Groovy's XMLSlurper. The condition should be that the text/value of the children nodes have to match. In the following example I want to search for a book node where the year is '2003' and the price is…
Pirth
  • 27
  • 2
  • 8
1
vote
2 answers

Parse xml using XmlSlurper in Groovy

I have an xml response which looks like :-
the_D
  • 890
  • 13
  • 26
1
vote
1 answer

Groovy XmlSlurper: Find attribute name by attribute value in XML

How can I find an attribute name in XML structure by attribute value using Groovy XmlSlurper/XmlParser. Let's say we have XML:
Alex
  • 142
  • 2
  • 13
1
vote
2 answers

Groovy GPath find nodes by many conditions

Suppose having XML:
lospejos
  • 1,976
  • 3
  • 19
  • 35
1
vote
1 answer
1
vote
2 answers

Iterate all children with a given name using GPathResult returned by XmlSlurper

I've parsed some html using XmlSlurper. Now I want to iterate all the children with a given element name. What I've got now is the following code snippet html.'**'.findAll { it.name() == 'a' }.each { println it } It works…
Daniel Seidewitz
  • 720
  • 8
  • 23