Android-Groovy-string.xml-增删改查-简单讲解

废话不多说,直接上代码

如何查询

    def xmlReader = new XmlSlurper().parse(inputFile)
    xmlReader.children().each {
        println("key == ${it.@name}, value == ${it.text()}")
    }

    Node inputNode = openXml(inputFile)
    inputNode.children().each {
        println(it.attributes()["name"] + ", " + it.text())
    }

static def openXml(xml) {
    def xmlParser = new groovy.util.XmlParser()
    def result = xmlParser.parse(xml)
    return result
}

如何删除

            for (i in 0..

你可能感兴趣的:(Android-Groovy-string.xml-增删改查-简单讲解)