Questions tagged [gpath]

Path expression language integrated into Groovy which allows parts of nested structured data to be identified. Can be used to query XML and nested Plain Old Java Objects

An overview of GPath with some sample code can be found on the codehause.org site

http://groovy.codehaus.org/GPath

79 questions
0
votes
0 answers

How to extract values with GPath from RestAssured map response?

Having the following JSON response, how can I get a list of items foo and bar or values of zoneGroup under each element using GPath or RestAssured built-in JsonPath? { "priceZones": { "foo": [ { "zoneGroup": "foo", …
Vitali Plagov
  • 722
  • 1
  • 12
  • 31
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

Store GPath expressions externally

I'm using groovy to process some XML and I've read through the following tutorial http://groovy-lang.org/processing-xml.html. I understand how to replaceNodes but what I'd like to do is store these gpath expressions in a file and read them in at run…
K2J
  • 2,573
  • 6
  • 27
  • 34
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
1 answer

GPath on nested objects

I'm not sure what I'm doing wrong here and I'm having a hell of a time with getting this to work properly. Using this JSON: { "books": [ { "category": "reference", "author": { "name": "Nigel…
Nabeel S.
  • 1
  • 1
0
votes
1 answer

How to obtain Attribute Values of an XML with XMLPath?

I have an XMLPath Object, and I wish to take the attribute names for some nodes. For Example,
0
votes
2 answers

Passing XML Paths and evaluating

I'm working on a project where I need to parse an XML file and perform the exact same code on 100s of different XML Paths/Nodes. My code currently looks like this… def items = parser.parseText(inputFile.text) items.item.each { item -> try { …
dscl
  • 1,616
  • 7
  • 28
  • 48
0
votes
0 answers

Groovy GPath find all children nodes by condition

Given this XML
lospejos
  • 1,976
  • 3
  • 19
  • 35
0
votes
1 answer

Groovy gpath not working when used with prefixed xml tags

I am having some namespace issues with gpath. String record = ''' 017003167 Peter
user292049
  • 1,138
  • 1
  • 14
  • 20
0
votes
1 answer

Find GPath exists in given XML document using Groovy

In Groovy given a GPath I want to find that the path exists in XML document. So that I can set a value for the node. I can use xmlslurper for parsing the document. GPath is a string path represented in slashes format.
Bharath Reddy
  • 301
  • 2
  • 4
  • 15
0
votes
1 answer

How to apply predicate to GPath when I am using XMLSlurper

lets say I have the following XML 29.01.2015 0102
jazzyekim
  • 101
  • 1
  • 10
0
votes
1 answer

How to access parent XML elements using Groovy/GPath

Using the following XML can anyone tell me how in Groovy (Gpath or Xpath) I perform a select on the left most element and also include a reference back to the correct parent element?
Stokie
  • 35
  • 4
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
0 answers

Groovy : fetching values of nested objects using xpath kind

I have POJO with nested objects which i need to translate to a simple object with out nesting for example i have a Person and Address as below public class Person { private String firstName; private String lastName; private Address…
rajn
  • 180
  • 2
  • 13
0
votes
1 answer

XmlSlurper in Groovy Script --- Insert nodes to GpathResult using external closures

I have a problem with the below scenario: -- I have a GPathResult "body" to which I want to append some more xml (nodes and children) -- Some parts are common so I am trying to have them kept in an outer closure "commonNode" I can insert wherever I…
Shinoko
  • 3
  • 1
  • 2