Richard Quadling writes: > On 8 July 2010 08:07, Gary wrote: >> Why am I still getting an exception when I do this: >> >> libxml_use_internal_errors(true); >> $this->xml = new SimpleXMLElement($this->htmlString); >> >> or this >> $this->xml = new SimpleXMLElement($this->htmlString, >> LIBXML_NOERROR|LIBXML_NOWARNING); >> >> ? >> >> The exception says "Exception: String could not be parsed as XML". ... > The XML needs to be "well formed" .
I thought so, thanks. What does libxml_use_internal_errors do then, if it doesn't allow me to handle those problems in my own code? > So, if it is junk, you can't > read it using SimpleXML as the XML is not well formed. I'm trying to just use xml_parse and so on now. This problem really should be *so* easy. In fact I've already solved it once X( > Try putting it through Tidy first - that is, tidy the file first. Ha ha! Sorry. It's almost certainly not available. I don't want to talk about it *cries* -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php