FAQ Database Discussion Community


Parse RSS with groovy

parsing,groovy,rss,xmlslurper
I am trying to parse RSS feeds with groovy. I just wanted to extract the title and description tags' value. I used following code snippet to achieve this: rss = new XmlSlurper().parse(url) rss.channel.item.each { titleList.add(it.title) descriptionList.add(it.description) } After this, I am accessing these values in my JSP page. What is...

How to extract data from SOAP-request in SOAP UI

groovy,soapui,xmlslurper
I'm creating mock SOAP-response which should return data contained in SOAP-request. Please, find a request sample: SOAP-Request: <v01:GetAncillaryOffersRQ version="1.0"> ... <v01:PNRLocator itineraryRef="itinerary_1">AAAAAA</v01:PNRLocator> ... </v01:GetAncillaryOffersRQ> Please, find mock-response which should be returned: Mock Response: <soapenv:Header></soapenv:Header> <soapenv:Body> <v01:GetAncillaryOffersRS version="?"> <v021:ApplicationResults status="?"> <v021:Error...

Access attribute on node which has namespace

groovy,xmlslurper
I have the xml I pasted in the post and I want to use groovy XmlSlurper to access node language with attribute xlink:href that is not null/empty. I read the xml with XmlSlurper in the following way: def node = xmlSlurper.parseText(xml).declareNamespace( xlink:"http://www.w3.org/1999/xlink" ); then I try to access all nodes...

groovy/XML: Replace a node by another one

xml,groovy,xml-parsing,xmlslurper
I try to replace an XML node by another one by using XmlSlurper (or XmlParser). The original XML: <myXml> ... <myNode> <Name>name1</Name> <Name>name2</Name> <Name>name3</Name> </myNode> ... </myXml> The list that contains the items to build my new node def namelist = ['name4','name5','name6','name7'] What I want to have <myXml> ... <myNode>...

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

grails,groovy,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 <xml> <Email> <From> <Address>[email protected]</Address> <Alias>Foo Bar</Alias> </From> <Email> </xml> This is what I tried initially: XmlSlurper slurper = new...