문제

하는 동안 분석을 사용하여 html 을 Yahoo Query Language 및 xpath 기능을 제공하 YQL,I ran 의 문제로 추출 할 수 없다는 텍스트"()"또는 속성 값이 있습니다.
예를 들어,
perma 링크

select * from html where url="http://stackoverflow.com" 
and xpath='//div/h3/a'

의 목록을 제공합 앵커로 xml

<results>
    <a class="question-hyperlink" href="/questions/661184/filling-the-text-area-with-the-text-when-a-button-is-clicked" title="In ASP.net, I need the code to fill the text area (in the form) when a button is clicked. Can you help me through by showing a simple .aspx code containing the script tag? ">Filling the text area with the text when a button is clicked</a>...
</results> 

지금은 때에 내가 추출하려고 노드를 사용하여 가치

select * from html where url="http://stackoverflow.com" 
and xpath='//div/h3/a/text()'

내가 결과를 얻을 연결된 보다는 오히려 노드 목록 예:

<results>Xcode: attaching to a remote process for debuggingWhy is b
…… </results>

어떻게 별도 그것으로 노드 목록 어떻게 나 선택 특성 값 ?

이와 같은 쿼리

select * from html where url="http://stackoverflow.com"
and xpath='//div/h3/a[@href]'

나에게 동일한 결과에 대한 쿼리 div/h3/a

도움이 되었습니까?

해결책

YQL 필요 xpath 표현을 평가하는 itemPath 보다는 오히려 노드를 텍스트입니다.하지만 일단 당신이 itemPath 할 수 있는 프로젝트를 다양한 값을 나무에서

다시 말해서는 ItemPath 트 노드에서 결과 HTML 보다는 텍스트의 콘텐츠/속성이 있습니다.YQL 일치하는 모든 노드가 반환하고 자신의 아이들이 선택한 경우*에서 데이터입니다.

select * from html where url="http://stackoverflow.com" and xpath='//div/h3/a'

이를 반환하는 모든의 일치하는 xpath.지금 프로젝트를 텍스트할 수 있는 콘텐츠 프로젝트를 사용하여 그것을 밖으로

select content from html where url="http://stackoverflow.com" and xpath='//div/h3/a'

"컨텐츠"텍스트를 반환합니다 내용 내에서 개최 노드입니다.

에 대한 예 특성을 지정할 수 있습니다,그것은 상대적 xpath 표현이다.이 경우에는,필요가 있기 때문에 href 는 상대적입니다.

select href from html where url="http://stackoverflow.com" and xpath='//div/h3/a'

이를 반환 <results> <a href="/questions/663973/putting-a-background-pictures-with-leds"/> <a href="/questions/663013/advantages-and-disadvantages-of-popular-high-level-languages"/> .... </results>

는 경우 필요한 모두 특성'href'과 textContent,다음을 실행할 수 있습니다 다음 YQL 쿼리:

select href, content from html where url="http://stackoverflow.com" and xpath='//div/h3/a'

을 반환합니다.

<results> <a href="/questions/663950/double-pointer-const-issue-issue">double pointer const issue issue</a>... </results>

는 희망 도움이 됩니다.알려주는 경우에 당신은 더 많은 질문이에 YQL.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top