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
2 answers

Groovy XML SLurper can't access child node

I've recently started using XML Slurper and am trying to access a specific child node from a SOAP envelope. Below is an extract of the XML I'm working with: Robert
ChrisG29
  • 1,501
  • 3
  • 25
  • 45
0
votes
2 answers

Retrieve values from response xml using XML Slurper didin't work

I am trying to retrieve a value from a XML response but it prints nothing.Please note that I am using SOAP UI to test the webservice and has written a simple piece of code to retrieve the policyid from the below response xml. Below is the code; if…
0
votes
1 answer

Insert child node in XML

need help with simple inserting node after specific one in XML using Groovy. Searching through the existing posts came to that, closer but not enough import groovy.xml.* def x='''
Nikolay Marinov
  • 101
  • 1
  • 3
  • 17
0
votes
1 answer

XmlSlurper to parse XML and get value of inside elements using Groovy

I am trying to parse the below XML:
Definition and Scope

A work that is modified for a purpose, use, or medium…

Rose
  • 1,490
  • 5
  • 25
  • 56
0
votes
2 answers

Groovy - XmlSlurper - count node

I am a newbee to Groovy, recently I need to count the complexity of a given XML data block. I figure out a way to determine if the data block is XML formatted or not. But I am not sure how to count all the nodes of the given XML block. Here is my…
dhg
  • 64
  • 1
  • 7
0
votes
1 answer

How to parse XML comments in Groovy?

Is there any way to parse XML comments in Groovy? Both XMLParser and XMLSluprer don't seem to support comments nodes. Suppose following file (example.html):
Paul
  • 78
  • 6
0
votes
1 answer

unable to parse xml with groovy

I can't read the xml and parse the items because it's always returning an error of groovy.lang.MissingPropertyException: No such property: method for class: Script1 def xmlText = new XmlSlurper().parse('myxml.xml') def skipped = 0 def failed =…
shaharnakash
  • 675
  • 3
  • 11
  • 39
0
votes
1 answer

Groovy XmlSlurper add " to all values

I want to use Groovy XmlSlurper to add " to both begin and end of all field values of a XML like below. 060 E010013787 10013787
Minh
  • 15
  • 3
0
votes
1 answer

Stop Combining Nested Values with XmlSlurper

I am trying to parse an XML document with XmlSlurper. This document has a lot of nested elements, and each one has a value. It follows this format:
Ben Bynum
  • 318
  • 2
  • 10
0
votes
1 answer

Remove values from xml document using groovy

I have a groovy system batch script that needs to read in an XML document, change the values, and then save it. I have figured out how to read the value and write it. I cannot figure out for the life of me how to remove 'members' and its values. I…
Nicole Phillips
  • 753
  • 1
  • 18
  • 41
0
votes
1 answer

Groovy xmlSlurper to remove empty fields

I have a code that is removing empty fields using XMLParser, I wonder if could you help me to have a version of the same using xmlSlurper instead. The code is below: File doc = new File("C:/Temp/input.xml") def text = new String(doc.bytes,…
Raul Biondo
  • 17
  • 1
  • 8
0
votes
1 answer

prevent groovy from changing " to "

I have an XML that has a tag value like the following: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD><TITLE></TITLE> <META…
0
votes
2 answers

Trim response value which needs to be used in next request in SoapUI

When I initiate a soap request, I receive a phone number with prefix 91 (eg. 919876543210) as a response. I want to use this number as an input value in other request through transfer property but without the prefix 91 (eg. 9876543210).Please help…
Nexus5 Siingh
  • 11
  • 1
  • 4
0
votes
3 answers

XmlSlurper never finds node

I'm trying to page scrape some DOM that looks like this: text and sometimes looks like this:

text

However, I just can't seem to figure out how to get text in the second scenario. I've tried several methods, and…
Stefan Kendall
  • 66,414
  • 68
  • 253
  • 406
0
votes
1 answer

Create a Map with specific parent node value and all of its child node values of an XML

I have a sample LEDES XML file https://codebeautify.org/xmlviewer/cbdc79e7 and I am trying to create a Map with Invoice node's inv_id value as key and all of its child elements file_item_nbr values as below ['Invoice 31' :…
OTUser
  • 3,788
  • 19
  • 69
  • 127