title: Read a Xml file in Groovy
body: <p>I am reading a xml file in groovy something like below, but don't know what is going wrong.</p>
  
  <p>Below is my function</p>
  
  <pre><code>def setEnvironment(Map env,Map params)
  {
      def records=new XmlSlurper().parse(env.get("ABC_HOME")+"/isp/config/nodemeta.xml")
  
  
      def jdbcurl=records.'domainservice:DBConnectivity'[0].@dbConnectString
      params.put("dn", records.'domainservice:GatewayNodeConfig'[0].@domainName)
      params.put("dh", records.'domainservice:GatewayNodeConfig'[0].'address'[0].@host)
      params.put("dp", records.'domainservice:GatewayNodeConfig'[0].'address'[0].@httpPort)
      params.put("u", records.'domainservice:DBConnectivity'[0].@dbUsername)
      if(jdbcurl==null||jdbcurl.size()==0)
      {
          params.put("tns", records.'domainservice:DBConnectivity'[0].@dbHost)
      }
      else
      {
          params.put("tns", jdbcurl.find("(?&lt;=%2F%2F)[\\d\\w_]+"))
      }
  
      println params
  
  }
  </code></pre>
  
  <p>My Output</p>
  
  <pre><code>[pd:admin, u:, tns:, dh:, dn:, dp:, un:admin, x:c1164035531]
  </code></pre>
  
  <p>My Xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
      &lt;imx:IMX xmlns:imx="http://com.abc.imx" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" serializationSpecVersion="4.0" crcEnabled="0" xmlns:domainservice="http://com.abc.isp.metadata.domainservice/2" versiondomainservice="2.4.1" xmlns:common="http://com.abc.isp.metadata.common/2" versioncommon="2.2.0" xsi:schemaLocation="http://com.abc.imx IMX.xsd http://com.abc.isp.metadata.domainservice/2 com.abc.isp.metadata.domainservice.xsd http://com.abc.isp.metadata.common/2 com.abc.isp.metadata.common.xsd"&gt;
  &lt;domainservice:GatewayNodeConfig imx:id="U:LtWHxY0ZEeGb2FwhP-xoGw" adminconsolePort="15533" adminconsoleShutdownPort="38207" domainName="D_1035531" nodeName="N_1035531" dbConnectivity="ID_1"&gt;
  &lt;address imx:id="ID_2" xsi:type="common:NodeAddress" host="absdie" httpPort="1531" port="1532"/&gt;
  &lt;portals&gt;
  &lt;NodeRef imx:id="ID_3" xsi:type="common:NodeRef" address="ID_2" nodeName="N_1035531"/&gt;
  &lt;/portals&gt;
  &lt;/domainservice:GatewayNodeConfig&gt;
  &lt;domainservice:DBConnectivity imx:id="ID_1" dbEncryptedPassword="ZmTXZDoYq0TyrU7fSaS9BrAlIuZyS2rw%2FafW1TLWE4g%3D" dbHost="fortuner" dbName="ORCL" dbPort="1521" dbType="ORACLE" dbUsername="zx1649355388"/&gt;
  &lt;/imx:IMX&gt;
  </code></pre>
  
  <p><strong>Note</strong>: pd &amp; x are already there in the map</p>