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

NiFi ExecuteScript Groovy: java.lang.reflect.UndeclaredThrowableException in XmlSlurper().parseText()

The content is a valid XML text. But XmlSlurper().parseText(content) produced a java.lang.reflect.UndeclaredThrowableException Questions: is there a possibility to verify the XML to find out, what the problem is? How ca I handle this exception in…
1
vote
2 answers

Groovy xml to map grouping duplicate keys

I have a xml response and i want it to be converted to a map but some xml nodes are duplicate so i want those to be converted to List of maps. Currently I'm using this code suggested in this post…
arash yousefi
  • 376
  • 5
  • 16
1
vote
1 answer

XMLSlurper appendNode does not see changes

I am having troubles using XMLSlurper to update an XML document. Most things work, but in some situations a "find" doesn't find a Node I just appended (appendNode). The new Node is there at the end of processing, but is not found when I am in the…
Mark
  • 1,988
  • 2
  • 24
  • 42
1
vote
0 answers

Remove a node in XML using XmlSlurper in Groovy

I have a XML that contains a snippet like aaa bbb Now I want to remove the node/tag that contains the value "bbb" in the XML using XmlSlurper in groovy. Any help?
Vishnu
  • 7
  • 1
1
vote
1 answer

XmlSlurper parseText - node name replace with variable

Parsing the XML response, I'm declaring all the node's name in an array list myTag, and call the API endpoint and get the XML response text and stored in xmlResult. then I looping all the node values and get the node text. my code def myTag…
Prabu
  • 3,550
  • 9
  • 44
  • 85
1
vote
3 answers

Path resolution in eclipse package structure

This is a very simple question for many of you reading this, but it's quite new for me. Here is a screenshot for my eclipse When i run this program i get java.io.FileNotFoundException: queries.xml (The system cannot find the file specified) i tried…
AabinGunz
  • 12,109
  • 54
  • 146
  • 218
1
vote
1 answer

How to iterate through Nested XML after parsing using groovy with slurper or parser

I'm Facing an issue with iteration of below xml because it neglects some part. Can anyone guide me through this Apple App
1
vote
1 answer

Groovy to get node values from XML in SoapUI response

I try to get node values from XML response in a Groovy script in SoapUI. XML file sample:
plaidshirt
  • 5,189
  • 19
  • 91
  • 181
1
vote
1 answer

How to print the path for current XML node in Groovy?

I am iterating through an XML file and want to print the gpath for each node with a value. I spent the day reading Groovy API docs and trying things, but it seems that what I think is simple, is not implemented in any obvious way. Here is some code,…
ou_ryperd
  • 2,037
  • 2
  • 18
  • 23
1
vote
2 answers

Getting attribute values from XML nodes with namespace in soapui using groovy

Below is my xml and i want to get the attribute value using groovy language so that i can use that in SoapUI assertion XXXXXX I want to get…
1
vote
2 answers

How to get all the sub tags as list using XmlSlurper

I want to read all the variable names from an xml file. However while I would expecxt some sort of List I get all the "Names" glued together. How an I get all the Names in a List? Xml: 1.0
KIC
  • 5,887
  • 7
  • 58
  • 98
1
vote
2 answers

How to extract CDATA without the GPath/node name

I'm trying to extract CDATA content from an XML without the using GPath (or) node name. In short, i want to find & retrieve the innerText containing CDATA section from an XML. My XML look like: def xml = '''
user1523153
  • 139
  • 3
  • 10
1
vote
1 answer

Groovy XMLSlurper how to append a child element after an existing element?

I'm using XMLSlurper to parse a XML in Groovy. An element should be added to the parsed XML (GPathResult instance), but the new element should be at a specific position, after an existing element, to be compliant with the XML Schema. Right now the…
Pablo Pazos
  • 3,080
  • 29
  • 42
1
vote
1 answer

Using XPath with GPathResult to find all nodes and add new attribute

Edited... My knowledge in Groovy is basic and I need to perform the following action which I have no idea how to do. let's say I have this XML:
Yossi Even
  • 45
  • 8
1
vote
2 answers

How to extract XML nodes from Soap Response in SoapUI Groovy without namespaces?

I want to extract the data between 2 nodes Insu and /Insu from the below XML without namespaces in output
Gaurav Khurana
  • 3,423
  • 2
  • 29
  • 38