On Wed, Feb 07, 2007 at 10:21:15AM -0500, =?UTF-8?Q? Emmanuel_M._D=C3=A9carie 
?= wrote:

> Adding to this problem, I discovered also that the DOM and simplexml  
> extensions can???t use the PHP5 exception handling to trap the errors  
> when the XML is not well-formed. Using simplexml or the DOM  
> extensions against not well-formed XML, the errors generated by these  
> extensions are not trapped and are displayed immediately.

$sxml = @simplexml_load_string($xml);
if ($sxml === false) {
    // do what you will about the problem.
}

OR

$php_errormsg = '';
if (!$dom = @DOMDocument::loadXML($xml)) {
    // $php_errormsg contains error info.
} elseif ([EMAIL PROTECTED]>schemaValidate('schema_file.xsd')) {
    // $php_errormsg contains error info.
}

--Dan

-- 
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
            data intensive web and database programming
                http://www.AnalysisAndSolutions.com/
 4015 7th Ave #4, Brooklyn NY 11232  v: 718-854-0335 f: 718-854-0409
_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk

NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com

Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php

Reply via email to