开发者

How to copy the contents of one xml file to another file in Grails?

开发者 https://www.devze.com 2023-02-16 13:18 出处:网络
I have created one XML f开发者_JAVA技巧ile using Grails, now I want to copy the contents of this file to a datacenter. How to do it?It depends on how you need to make the copy of the file, if it is in

I have created one XML f开发者_JAVA技巧ile using Grails, now I want to copy the contents of this file to a datacenter. How to do it?


It depends on how you need to make the copy of the file, if it is inside your code, i.e. programmatically, you can use AntBuilder groovy library but if it is something that you can do inside the Grails scripts you can use Ant.copy to copy the file, something like this:

Ant.copy(toFile: "${newPathForFile}/newFileName.xml", filtering: true, overwrite: true) {
  fileset(file: "${pathWhereFileIs}/fileName.xml")
}


You can use the antbuilder from groovy. Maybe you have to add some libs.

0

精彩评论

暂无评论...
验证码 换一张
取 消