解析された HTML (XML に変換) の body ノードから属性を削除する必要があります。
4341 次
2 に答える
5
attributes()
属性を含む要素で を呼び出してから、remove('attr name')
以下に示すように呼び出します。
attributes().remove('attr name')
詳細については、こちらをご覧ください。
于 2011-12-20T22:41:27.247 に答える
2
/**
* Remove all attributes from the root body tag
*/
def removeBodyAttributes() {
def attributeNames = bodyXml.attributes().collect {it.key}
println attributeNames
println bodyXml.attributes()
attributeNames.each {bodyXml.attributes().remove(it)}
println bodyXml.attributes()
}
于 2011-12-20T23:01:37.947 に答える