Read a Xml file in Groovy

后端 未结 1 972
日久生厌
日久生厌 2021-01-28 12:45

I am reading a xml file in groovy something like below, but don\'t know what is going wrong.

Below is my function

def setEnvironment(Map env,Map params)
         


        
相关标签:
1条回答
  • 2021-01-28 13:37

    XmlSlurper is handling the namespaces for you... Just get rid of the namespace part of the node names (note the more Groovy map management as well)

    params.dn = records.GatewayNodeConfig[0].@domainName.text()
    params.dh = records.GatewayNodeConfig[0].address[0].@host.text()
    params.dp = records.GatewayNodeConfig[0].address[0].@httpPort.text()
    params.u  = records.DBConnectivity[0].@dbUsername.text()
    
    0 讨论(0)
提交回复
热议问题