簡體   English   中英

如何解析groovy中的xml文件並將其放在pojo中?

[英]How parse xml file in groovy and put it in a pojo?

有人告訴我groovy xml解析器更好,更簡單,我的問題是如何在Java中使用groovy解析xml文件並將其放在pojo對象中? 謝謝。

Groovy編譯器具有稱為“聯合編譯”的功能。 這用於與另一個java項目一起編譯groovy項目。 在他們的網站中定義為

Joint compilation means that the Groovy compilation will parse the Groovy source files, create stubs for all of them, invoke the Java compiler to compile the stubs along with Java sources, and then continue compilation in the normal Groovy compiler way. This allows mixing of Java and Groovy files without constraint.

但是要注意的是,隨着項目代碼庫的增加,它會導致靜態引用出現一些問題。 如果您使用Maven或Ant腳本來編譯代碼,那么生活會變得更加輕松。

參考鏈接: http : //groovy.codehaus.org/The+groovyc+Ant+Task

您還可以查看此鏈接http://today.java.net/pub/a/today/2004/08/12/groovyxml.html ,其中用戶嘗試了很多選項,包括Groovy。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM