I have to parse 1.5 Giga XML file using XMLReader for php. This files are structured in block of data. Inside each block of data I have a CDATA part that contains huge xml code that I have to parse too.
Using XMLReader I can access to the file and read it in streaming. How can I read the embedded CDATA xml and parse it without have error of "huge input lookup".
What I do:
case (XMLREADER::CDATA):
// echo "found CDATA \n" ;
$value = $reader->value; echo "Read CDATA\n";
$xmlReader = new XMLReader(); echo "New XMLReader\n";
$xmlReader->xml ( $value) ; echo "Parsing CDATA ... \n";
$nTx =0;
$_root ="";
$_parent= array();
$_name = "NONE";
$_liv=0;
echo "Start ... \n";
while ( $xmlReader->read()) {
...
This fails when I do $value = $reader->value; because too large data. How can read in streaming the CDATA block ? Thnx
No comments:
Post a Comment