🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.php
Article #220260

problem z childNodes (DOM)

#220260
From: jivanmuktaWYTNIJTO
Date: Fri, 21 Aug 2009 13:26
40 lines
2127 bytes
Piszę program w PHP5 który analizuje wyciąg bankowy w HTMLu. 
Dla poniższego fragmentu:

<tr>
<td align="left" class="pad" height="30">05-10-2003</td>
<td align="left" class="pad" height="30">Trans.kart&#177; płatnicz&#177;</td>
<td align="left" class="pad" height="30">6764220012301234 - ZAKUP : PPH.,
WARSZAWA, PL : na kwotę 77,07 PLN z dnia 
05/10/2003</td>
<td align="right" class="pad" nowrap height="30">-77.00</td>
</tr>

program wyświetla:

object(DOMNodeList)[5]
string '05-10-2003' (length=10)
string '
' (length=2)

Oto fragment tego programu:

$tags = $statementDOM->getElementsByTagName('tr');
while ($i < $tags->length) {
	$el = $tags->item(++$i);
	if ($el->nodeType != XML_ELEMENT_NODE || $el->nodeName != 'tr' ||
!$el->hasChildNodes()) {
		continue;
	}
	$children = $el->childNodes;
var_dump($children);
	$operationDate = $children->item(0)->nodeValue;
	$operationType = $children->item(1)->nodeValue;
var_dump($operationDate, $operationType);
}

Problem: nie wiem dlaczego nie 'Trans.kart&#177; płatnicz&#177;' jako $operationType.
Byłbym wdzięczny za pomoc.

-- 
Wysłano z serwisu OnetNiusy: http://niusy.onet.pl
Technical Details
Message-ID: <7b4d.0000002b.4a8ea0a1@newsgate.onet.pl>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!newsfeed.pionier.net.pl!news.internetia.pl!news.nask.pl!news.nask.org.pl!news.onet.pl!newsgate1.onet.pl!niusy.onet.pl

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!newsfeed.pionier.net.pl!news.internetia.pl!news.nask.pl!news.nask.org.pl!news.onet.pl!newsgate1.onet.pl!niusy.onet.pl
From: jivanmuktaWYTNIJTO@poczta.onet.pl
Newsgroups: pl.comp.lang.php
Subject: problem z childNodes (DOM)
Date: Fri, 21 Aug 2009 15:26:57 +0200
Organization: Onet.pl
Lines: 40
Sender: news@newsgate.onet.pl
Message-ID: <7b4d.0000002b.4a8ea0a1@newsgate.onet.pl>
NNTP-Posting-Host: newsgate1.onet.pl
Mime-Version: 1.0
X-Trace: newsgate.onet.pl 1250861218 11576 213.180.130.17 (21 Aug 2009 13:26:58 GMT)
X-Complaints-To: niusy@onet.pl
NNTP-Posting-Date: Fri, 21 Aug 2009 13:26:58 +0000 (UTC)
X-Mailer: http://niusy.onet.pl
X-Forwarded-For: 83.10.195.95, 10.174.28.62
X-User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; pl; rv:1.9.0.13)   Gecko/2009073022 Firefox/3.0.13 (.NET CLR 3.5.30729)
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit