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

Groovy XMLSlurper issue

I want to parse with XmlSlurper a HTML document which I read using HTTPBuilder. Initialy I tried to do it this way: def response = http.get(path: "index.php", contentType: TEXT) def slurper = new XmlSlurper() def xml = slurper.parse(response) But…
jjczopek
  • 3,319
  • 2
  • 32
  • 72
1
vote
1 answer

Adding A Node To A Nodelist Using XmlParser In Groovy

When I add a Node to a NodeList using the XmlParser in Groovy, the NodeList does not appear to reflect the change. Here is the code that I'm testing within the GroovyConsole. If you run this code, you should see the output "ADD FAILED" followed by a…
1
vote
1 answer

Unable to find content by tag name using XMLSlurper

I'm trying to search in an XML file using XMLSlurper and after reading some past questions thought this would be the way to do so, however it isn't working. This is the xml content:
Gruntcakes
  • 37,738
  • 44
  • 184
  • 378
1
vote
1 answer

Groovy: keeping of CR/LF of attributes while serializing XMLSlurper

I'm new with groovy (a few weeks of experience). Currently I'm trying to process some visual studio .vcproj files using groovy: replacing some paths, that will be found by a regexp patterns. This works fine for me. To write the changes to the file,…
1
vote
0 answers

How to find URL of page returned from XmlSlurper.parse(aURL) after redirect in Groovy

How do I in Groovy get the URL of a page returned from XmlSlurper.parse(aURL) after redirect. Wild guessed and tried parser.getProperty("document.location") without luck.
HenrikLH
  • 11
  • 1
1
vote
1 answer

Groovy XmlParser / XmlSlurper: node.localText() position?

I have a follow-up question for this question: Groovy XmlSlurper get value of the node without children. It explains that in order to get the local inner text of a (HTML) node without recursively get the nested text of potential inner child nodes as…
SputNick
  • 1,231
  • 5
  • 15
  • 26
1
vote
1 answer

How to remove attributes from XML node in groovy

I am trying to parse an XML file and get a subset of nodes, with certain attributes removed. A sample of what I have tried: def xml = """ Some text Foo Some other…
msuku
  • 13
  • 4
1
vote
3 answers

Grails/Groovy problem with XmlSlurper .. help

Using grails 1.2.2 with groovy 1.6.8 .. Reading a a web service and trying to process response .. Response is shown below and validates as correct xml .. (sorry for length) ..
Rob Morning
  • 11
  • 1
  • 2
1
vote
1 answer

Groovier way to find next XmlSlurper element in parent?

I am using: def idx=parent.item.children().indexOf(myElement) if (idx+1
Миша Кошелев
  • 1,483
  • 1
  • 24
  • 41
1
vote
2 answers

mkp.yieldUnescaped not working

I am really stuck here. I am creating an XML document with Groovy 1.7 and everything is working except one section is being escaped when it shouldn't. I am starting out like this: triadDoc = new…
Mark
  • 1,988
  • 2
  • 24
  • 42
1
vote
2 answers

SOAPUI: Modify Request: Groovy: appendNode applicable arguments

I'm trying to modify a SOAP Request by adding a duplicate child node with different value. This is what I have so far: Request:
ssc
  • 35
  • 2
  • 9
1
vote
1 answer

XmlSlurpur The prefix "something" for element "something:element" is not bound

I am using XmlSlurper like so: def slurper = new XmlSlurper().parseText(xmlObj.lensData).declareNamespace(something:'something') when i slurp the following xml it give an error:
Sagarmichael
  • 1,624
  • 7
  • 24
  • 53
1
vote
1 answer

How Can I Use Config Entries with Dots When Parsing with XmlSlurper

I'm trying to use a groovy Config entry to parse an xml file with XmlSlurper. Here's the Config file: sample { xml { frompath = "Email.From" } } Here's the XML
Jaye
  • 184
  • 8
1
vote
2 answers

Groovy Node- Add new child only adds closing tag

I'm running into an issue using Groovy to add new child nodes to an XML Document. I don't want any children in the new node, it's just a placeholder at this point. Basically, the code looks like trans = new Node(parent, translationsName, new…
AndrewSmiley
  • 1,933
  • 20
  • 32
1
vote
0 answers

Proper equality of GPathResults

I need to traverse through a XML and distinguish elments based on their parents. I use Groovy and XmlSlurper. I know that the GPathResults implements equals() as equality of text() nodes only. Sadly, thats not usable in my case. Using cmp via is()…
Yuri
  • 4,254
  • 1
  • 29
  • 46