SitePoint Sponsor |
|
User Tag List
Results 1 to 3 of 3
Thread: XML DOM question
-
Aug 10, 2007, 06:41 #1
- Join Date
- Nov 2001
- Location
- The Central Plains
- Posts
- 3,304
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
XML DOM question
how do I tell the DOM not to attempt to parse an XML file if it's invalid? I'll get warnings like this: "Warning: DOMDocument::loadXML() [function.DOMDocument-loadXML]: Space required after the Public Identifier in Entity, line: 1 in..." and such. below is the code that I've been using:
PHP Code:$dom=new DomDocument();
$dom->preserveWhiteSpace = false;
$dom->validateOnParse=false;
//$dom->loadXML($fxml);
$fxml=trim($fxml);
//echo $fxml;
if($dom->loadXML($fxml)==false){
...
-
Aug 10, 2007, 13:00 #2
I'm afraid the only way is suppressing the warnings:
Code php:if(@$dom->loadXML($fxml)==false){
Saul
-
Aug 10, 2007, 14:32 #3
- Join Date
- Nov 2001
- Location
- The Central Plains
- Posts
- 3,304
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
yeah prolly. it's a weird warning. back in my MS days, the dom reader would just not load it if it wasn't valid xml and give me a false return. thanks.
Bookmarks