我有来自包含50个地址的网站的商店价值,
<div class="storeContainer">
<div class="storeCount">50</div>
<div class="mapAddress" id="store50">
<h4 onclick="changeMap(50,38.872432,-78.530463);">Woodstock, VA</h4>
<h5>Woodstock Square</h5>467 West Reservoir Road
<br/>540-459-7505
<br/>
<a href="https://maps.google.com/maps?saddr=geo&daddr=467+West+Reservoir+Road+Woodstock+VA+22664&sll=38.872432,-78.530463&sspn=0.011265,0.014098&z=12"
class="getDirections">Get Directions</a>
</div>
</div>
</div>
这是一个商店示例,我得到的格式相同。我希望逐个迭代
Woodstock,VA
伍德斯托克广场西水库路
540-459-7505
我尝试使用以下代码
def envelope = new XmlParser().parseText(xml);
envelope.'**'.find { it.@class == 'mapAddress' }.with { node ->
println h4.text()
println h5.text()
println a.@'href'
println node.children().findAll { it.getClass() == String }*.trim()
}
到目前为止没有运气。