2008-09-19 13 views

cevap

17

aşağıdaki (Mükemmel 1.5.6) deneyin:

def doc = """ 
<html> 
    <body> 
     <div tags="1">test1</div> 
     <div>test2</div> 
     <div tags="">test3</div> 
     <div tags="4">test4</div> 
    </body> 
</html> 
""" 

def html = new XmlSlurper().parseText(doc) 

html.body.div.findAll { [email protected]()}.each { div -> 
    println div.text() 
} 

Bu çıkışlar:

test1 
test4