I am trying to understand how to iterate a .xml file in Jenkins so I create
a super simple .xml file:
```
<?xml version="1.0" encoding="utf-8"?>
<tag1>
<tag2>hello</tag2>
<tag3>bye</tag3>
</tag1>
```
I just want to get acces to a tag value (i.e. tag3) and print it out. I
have been reading a lot here on SO and I this is the cod I have:
```
import groovy.xml.*
pipeline {
agent any
stages {
stage('find') {
steps {
script{
def xml = readFile "C:\\Users\\anton\\Desktop\\test.xml"
def file = new XmlSlurper().parseTest(xml)
file.'**'.
findAll { it.name() == 'tag1' }
.each {println it.assetId.text()}
}
}
}
}
}
```
But I keep getting this error: ```hudson.remoting.ProxyException:
groovy.lang.MissingMethodException: No signature of method:
groovy.util.XmlSlurper.parseTest() is applicable for argument types:
(java.lang.String) values: [<?xml version="1.0" encoding="utf-8"?>```
If I try to use XmlParser() method I get the same error too. I have followe
these links [java.net.MalformedURLException: no protocol: XML][1] and it
seems to work fine for him I do not find further information from that error
[1]:
https://stackoverflow.com/questions/23027382/java-net-malformedurlexception-no-protocol-xml
--
You received this message because you are subscribed to the Google Groups
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/bd695356-0707-42fd-8252-8ab4c5f7ab28n%40googlegroups.com.