html에서 자식 노드의 값을 가져 오려고합니다.html에서 자식 노드의 값을 가져 오는 중
내가 시도하는 것 : -
$data = $dom->getElementById($identifier);
$node = $data->childNodes;
foreach($node as $node)
{
echo $node->nodeName;
echo $node->nodeValue;
}
}
내가 childtag이 값 내가 빈 문자열을 얻고이없는 경우에도 모든 childNodes에 값을 얻을 수 있어요.
태그에 적절한 값이 있으면 값을 가져 오는 방법이 있습니까 ???
업데이트 : -내 htmldata : -
가<div id="myid"> //I give this id as input
<h1> Some data 1</h1>
<script type=".."> google adsense details </script>
<p class="some class"> </p>
<div class="some class1"></div>
<h2>data2</h2>
<p>SOme more data...blah blah..</p>
</div>
는 내가 원하는 출력 : - 내가
Some data 1
data2
SOme more data...blah blah..
을 얻고 무엇을 : -
Some data 1
googleadsense details//i am getting values inside script as well
//blanc data which includes many spaces of tag p
//blanc data which includes many spaces of tag div
data2
SOme more data...blah blah..
'($ 노드와 노드 $)'또는'($ 노드로 데이터 $)'?? –
코드를 변경했습니다 ... –
무엇을 위해 투표 하시겠습니까 ?? –