我正在处理XML解析脚本。 XML有超过12.000个项目("术语"元素名称),但脚本只提供4489个元素。这是我的代码:
<?php
$doc = new DOMDocument();
$doc->preserveWhiteSpace = false;
$doc->load('theXML.xml');
$i=0;
while(is_object($ajanlatok = $doc->getElementsByTagName("term")->item($i)))
{
foreach($ajanlatok->childNodes as $nodename)
{ echo $i;
if($nodename->nodeName=='dep')
{
echo "<u>Indulás</u><br> Innen: ".$nodename->getAttribute('from')." - Ide: ".$nodename->getAttribute('to')." - Dátum: ".$nodename->getAttribute('date')."<br>";
}
elseif($nodename->nodeName=='prices')
{
foreach($nodename->childNodes as $subNodes)
{
echo $subNodes->nodeName."(ár) - ".$subNodes->nodeValue."<br>";
}
}
elseif($nodename->nodeName=='surcharges')
{
foreach($nodename->childNodes as $subNodes)
{
echo $subNodes->nodeName."(felár) - ".$subNodes->nodeValue."<br>";
}
}
elseif($nodename->nodeName=='rooms')
{
foreach($nodename->childNodes as $subNodes)
{
echo $subNodes->nodeName."(szoba) - ".$subNodes->nodeValue."<br>";
}
}
else
{
echo $nodename->nodeName." - ".$nodename->nodeValue."<br>";
}
}
echo "<hr>";
$i++;
}
?>
是否有任何限制或为什么我不能获得所有内容。 XML文件很大,70mb。