Closed ulrikls closed 5 years ago
Here's an example:
pipeline {
agent any
stages{
stage("clone") {
steps{
checkout([$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[url: 'https://github.com/surenpi/xml']]])
}
}
stage("xml") {
steps{
script{
def xml = readXml xmlFile: 'test.xml', nodeMap: [ status: "//server[machinename='clud-13783-t01']/status" ]
println xml.status.text
}
}
}
}
}
I thought that's what I did, but trying again today it works. Thank you for the quick reply.
Please let me know if there are any questions.
Is it mandatory to use nodeMap ?
@LinuxSuRen
this is my xml structure:
<servlet>
<servlet-name>productAppServlet</servlet-name>
<servlet-class>compnay.apps.fnd.product.common.servlet.module</servlet-class>
<init-param>
<param-name>compnay.apps.fnd.product.productList</param-name>
<param-value>product,hcm:orderdemo,product,scm:supply-chain,prc:procurement, ,payables,:expenses,joint-ventures,grc:grc,prj:grants-financials</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>AppServlet</servlet-name>
<url-pattern>/supply-chain/*</url-pattern>
<url-pattern>/procurement/*</url-pattern>
<url-pattern>/product/*</url-pattern>
<url-pattern>/product/*</url-pattern>
<url-pattern>/product/*</url-pattern>
<url-pattern>/product/*</url-pattern>
<url-pattern>/product/*</url-pattern>
<url-pattern>/product/*</url-pattern>
<url-pattern>/joint-ventures/*</url-pattern>
<url-pattern>/product/*</url-pattern>
<url-pattern>/grants-management/*</url-pattern>
<url-pattern>/federal-financials/*</url-pattern>
</servlet-mapping>
on servlet/init-param/param-value, i need to append new string to existing one. on servlet-mapping, i need to add a new entry for url-pattern with a new value for it.
i been trying multiple ways like (xmllint, xpath, groovy) but nothing i could achieve, is it possible to do with current plugin?
I have an XML file like:
I want to get the
status
for a givenmachinename
. Usingprints
com.surenpi.jenkins.phoenix.model.XmlNodeResult@6f9f2970
How do I get the value of thestatus
node? I've triedxml.status.text
andxml.status.getText()
, but both causes my pipeline to fail.