내가 다음과 같습니다 일부 DOM 긁어 페이지로 시도하고 발견하지 그러나XmlSlurper 노드
<span><p>text</p></span>
을, 난 그냥 수없는 것 두 번째 시나리오에서 text
을받는 방법을 찾아보십시오. 나는 여러 가지 방법을 시도하고, 여기에 내가 아래 작업을해야 무슨 생각했습니다
def html = slurper.parse(reader)
Collection<NodeChild> nodes = html.'**'.findAll { it.name() == 'span' && [email protected] == 'style2' }
...
def descriptionNode = html.'**'.find { it.name() == 'span' && [email protected] == 'style20' }
def innerNode = descriptionNode.'**'.find { it.name() == 'p' }
def description
if (innerNode?.size() > 0)
{
description = innerNode.text()
}
else
{
description = descriptionNode.text()
}
내가 필요로하는 동작을 취득 xmlslurper 사용에 대한 갈 필요가 어떻게 어떤 생각을?