Re: PHP_XML and CDATA
| From: | Thies C. Arntzen | Date: | Tue, 23 Nov 1999 15:10:10 +0000 |
| Subject: | Re: PHP_XML and CDATA | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-12993@lists.php.net to get a copy of this message | ||
On Tue, 23 Nov 1999, Helmut Franzke wrote:
> Hi,
>
> I did some experiments with PHP and XML, got a problem with CDATA
> and found the following notice in xml.c (PHP-4):
>
> /* Known bugs:
> * - Weird things happen with <![CDATA[]]> sections.
> */
>
> I downloaded expat 1.1, compiled it with gcc 2.95 on a win-nt box
> (on linux this evening at home ;-)) )
> and installed the new dll's. Now CDATA section works well.
>
> BTW: I found the function xml_parse_into_struct
i'm guilty... it's not documented..
just try the following code and see if thigs get "clear".
<?
function readf($filename)
{ $fp = fopen($filename,"r");
$buffer = fread($fp,filesize($filename));
fclose($fp);
return $buffer;
}
$parser = xml_parser_create();
xml_parser_set_option($parser,XML_OPTION_CASE_FOLDING,0);
xml_parser_set_option($parser,XML_OPTION_SKIP_WHITE,1);
$ok =
xml_parse_into_struct($parser,readf("/path/to/some/xml/file.xml"),&$myvalues,&$mytags);
var_dump($myvalues);
var_dump($mytags);
?>
>
> What does this function exactly? Get I a DOM-like array?
>
> Regards
> Helmut Franzke
>
>
Thies C. Arntzen "One Big-Mac, Small Fries and a Coke!"
Digital Collections Phone +49 40 235350 Fax +49 40 23535180
Hammerbrookstr. 93 20097 Hamburg / Germany