Xml代码<columns> <column> <name>ID</name> <describe>ID</describe> <comment /> <type>1</type> <length>16</length> <scale>0</scale> <control>0</control> <primary-property>2</primary-property> <nullable>true</nullable> <unique>false</unique> <enabled>true</enabled> <visible>true</visible> <option /> <Meta-column /> <ref-object /> <default /> <real-type>0</real-type> <attribute>0</attribute> <order-direction>0</order-direction> <Expression /> <invisible-Expression /> <disable-Expression /> <category /> <fire-event>0</fire-event> <check-type>0</check-type> <valIDation /> <constraint /> <scope-permissions /> </column> <column> <name>InstID</name> <describe>InstID</describe> <comment /> <type>1</type> <length>16</length> <scale>0</scale> <control>0</control> <primary-property>0</primary-property> <nullable>true</nullable> <unique>false</unique> <enabled>true</enabled> <visible>true</visible> <option /> <Meta-column /> <ref-object /> <default /> <real-type>0</real-type> <attribute>0</attribute> <order-direction>0</order-direction> <Expression /> <invisible-Expression /> <disable-Expression /> <category /> <fire-event>0</fire-event> <check-type>0</check-type> <valIDation /> <constraint /> <scope-permissions /></column>
def langs = new XmlParser().parse("languages.xml")
println "type = ${langs.attribute("type")}"
langs.language.each{
println it.text()
}
解析xml
def langs = new XmlParser().parse("J:\\objectBuild\\zhaobiao\\web-app\\xml\\T_ZFCG_CGSQ.xml")
langs."columns"."column".each{
println it."name".text()
println it."describe".text()
}
langs.columns.column.each {
println "String "+" "+it.name.text()+" //"+it.describe.text()
}
总结以上是内存溢出为你收集整理的groovy构建和解析 XML全部内容,希望文章能够帮你解决groovy构建和解析 XML所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)