[請益] 請問DOM中的節點列是指??
<tgroup cols="4">
<thead>
<row>
<entry>Title</entry>
<entry>Author</entry>
<entry>Language</entry>
<entry>ISBN</entry>
<entry>2006</entry>
</row>
</thead>
<tbody>
<row>.........略....
以上是我測試的資料片段
我用php得dom..先取得<row>節點列
$row = $doc->getElementsByTagName('row');
echo $row->item(0)->nodeValue."\n";
若列印第一個row節點會有以下結果
***************
Title
Author
Language
ISBN
2006
*****************
因為我想是雁如何個別取到<entry>...我用了childNodes方法
$list = $row->item(0)->childNodes;
結果卻得到
$list->length=11
列印的的話--echo "Value=".$list->item($i)->nodeValue."\n";
Value=
Value=Title
Value=
Value=Author
Value=
Value=Language
Value=
Value=ISBN
Value=
Value=2006
Value=
疑問:
1.請問那個長度11是怎麼算的呢?
這長度不是指該節點的元素個數?
2.回到我最初的好奇..若我取得所有row元素的節點
我要用何種方式取得<entry>的nodeValue?
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 134.208.7.51
討論串 (同標題文章)
以下文章回應了本文:
完整討論串 (本文為第 1 之 2 篇):
PHP 近期熱門文章
PTT數位生活區 即時熱門文章