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

Find an element in XML using XML Slurper

"I have a code that is working as expected but now I have to find the element in different format. Example is below corolla
0
votes
2 answers

XmlSlurper Doesn't Parse the Whole XML

I'm trying to access parts of an XML string after it was processed with XmlSlurper (inside the WS Lite plugin in case that matters). Here's a sample XML string:
Harry Muscle
  • 2,247
  • 4
  • 38
  • 62
0
votes
2 answers

changing groovy version makes my xml slurping fail on xml:lang

In my xml file, that I read from a URL using def inp = url.openStream(...) def slurper = new XmlSlurper() def xml = slurper.parse(inp).declareNamespace(xml:'http://www.w3.org/XML/1998/namespace') I have
serafim
  • 75
  • 1
  • 1
  • 9
0
votes
2 answers

Using a variable to extract value of property of an element in groovy using xmlSlurper

I am using SoapUI to test webservices. The following string (in xml format) is my request: 1 ABC 1
Daisy
  • 1
  • 2
0
votes
1 answer

RestAssured and GPath expression for attribute not consistent

We use the REST-assured framework for doing some unit/integration testing in Java. The XML answer from a REST service is similar to this:
рüффп
  • 5,172
  • 34
  • 67
  • 113
0
votes
2 answers

XML Slurper - empty string for attributes

When parsing an attribute, the slurper sets an empty string when an attribute is not found. For e.g., car.setOwner(node.@owner.text()); In the above code, if the owner attribute is not found, then the slurper sets a blank string (""). In my case,…
saravana_pc
  • 2,607
  • 11
  • 42
  • 66
0
votes
1 answer

XmlUtil.serialize : Outputs tags in uppercase

I am trying to create a valid html document from html String content = getContent() def parser = new org.cyberneko.html.parsers.SAXParser() parser.setFeature('http://xml.org/sax/features/namespaces', false) def slurper = new…
Sudhir N
  • 4,008
  • 1
  • 22
  • 32
0
votes
1 answer

Using XmlSlurper in Groovy / Grails to parse a Pingdom XML response

I have used XmlSlurper successfully before, but am struggling to parse the following XML - it is a response from a call to the Pingdom API. I have tried following the namespace declaration examples, but I just get an error message on the ns1 and ns2…
peaky
  • 1
  • 1
  • 3
0
votes
1 answer

How to get html content using CyberNeko?

def page = new XmlSlurper(new SAXParser()).parse(url) println page.body[0] I want output

Header

where my html is: Title
Xelian
  • 16,680
  • 25
  • 99
  • 152
0
votes
1 answer

XMLSlurper to parse FXCop results?

I'm trying to parse FXCop XML to get a collection of all the "Issues..." tags with the values of their related "Level" attributes. I'm very new to Groovy so I'm stumbling with this one. The schema of the FXCop XML is very complex and the "Issues..."…
Richard Schaefer
  • 525
  • 3
  • 13
  • 45
0
votes
1 answer

Groovy: Why are equal GPathResult instances generating different hashCodes?

I was playing around with adding some XmlSlurper elements to a Set and making sure a slurper that parsed the same text as another wouldn't be added twice. def CAR_RECORDS = '''
jacobono
  • 3
  • 1
0
votes
1 answer

Parsing an XML in Groovy through XML Slurper

I am having this strange problem of parsing an xml through XMLSlurper in groovy and it shows the size as 0. Cannot figure out why. My xml file looks like:
user1470220
  • 123
  • 2
  • 15
0
votes
1 answer

How to I use a variable reference within XMLSlurper statement

I am using a groovy with XMLSlurper to validate my web service responses in soap ui pro. I have the following code which works (expectedResponse is var that stores expected errorcode e.g. E0023) ... if(expectedResponse2 in…
chucknor
  • 837
  • 2
  • 18
  • 33
0
votes
1 answer

Read a pom file for merge conflicts using XmlSlurper

Lookin for some help with XmlSlurper to get all merge conflicts in a pom.xml file. I want to get all tags with merge conflict markers (<<< === >>>) and update the file to use the higher version number. So the resulting file would just have…
DarVar
  • 16,882
  • 29
  • 97
  • 146
0
votes
1 answer

Unexpected results with groovy.util.slurpersupport.NodeChild.appendNode() (Groovy 2.2.1)

I think what I am trying to do is simple: Add child nodes dynamically to a node (without even knowing the name of the node to be added - developing some framework) using XmlSlurper. For ease of explaining, something like this: def colorsNode = new…