Re: xml_error_string

From: Date: Thu, 16 Nov 2000 19:35:23 +0000
Subject: Re: xml_error_string
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-25758@lists.php.net to get a copy of this message
On Thu, 16 Nov 2000, callen wrote: > > Hola: > > On my first entry into parsing xml , xml_error_string returns this > message: > > "not well-formed"...does that mean that the data that i am trying to > parse is not well-formed or perhaps that a handler has gone screwy? > > Currently I use fopen to retrieve the documnet, i store it in a variable > I then do this: > > //$results contains the whole xml response from the remote_server. > > $data = utf8_encode($results); > > if (! xml_parse ($xml_parser, $data)) { > $error = xml_error_string(xml_get_error_code($xml_parser)); > echo "Error was $error"; > } > > > BTW: I have gone thru the many tutorials and they helped in setting up > the necessary functions etc... > > thanks much for any advice etc... > Does your XML follow spec? The following is legal: <FIRSTTAG> <SECONDTAG /> </FIRSTTAG> The following is not: <FIRSTTAG> <SECONDTAG> </FIRSTTAG> If your XML looks like the second example above, then: CONGRATULATIONS! You have now discovered why I had to build my own pseudo-XML parser by hand. Have fun. -- Ignacio Vazquez-Abrams <ignacio@openservices.net>

« previous php.general (#25758) next »