0

誰かが私に、groovy xml パーサーの方が優れていて簡単だと言いました。私の質問は、java 内で groovy を使用して xml ファイルを解析し、それを pojo オブジェクトに入れる方法です。ありがとう。

4

1 に答える 1

1

Groovy コンパイラには「共同コンパイル」という機能があります。これは、groovy プロジェクトを別の Java プロジェクトでコンパイルするために使用されます。それは彼らのサイトで次のように定義されています

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 を含む多くのオプションを試してみることもできます。

于 2012-07-29T05:55:47.587 に答える