loadXML() strangeness
am 26.07.2007 22:16:36 von Bill Bolte
Maybe it's just me, but this isn't behaving as I think it should.
loadXML() is supposed to return T/F, depending on if it's succeeded or
not. and should throw a false if the XML isn't well-formed. however,
that's not what I'm seeing here. during some testing, the XML I'm trying
to load is blank (except for maybe a return), but it seems to be
returning true and trying to parse it. basically, all I'm doing is:
=20
if($dom->loadXML($fxml) == true){...}
and it appears that the code inside the if is running (I'm writing a
file out of the XML that's being parsed and it's showing up - although
it's empty). here's the warning that's being sent to the page:
Warning: DOMDocument::loadXML() [function.DOMDocument-loadXML]: Start
tag expected, '<' not found in Entity, line: 2 in
C:\www\op.dev\public_html\assets\inc\parser.php on line 278
Guess I could always check for a beginning <, but I assumed that
loadXML() would do this? what's the scoop here?
Bill
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
RE: loadXML() strangeness
am 26.07.2007 22:46:20 von Bill Bolte
Well, I stumbled across this, and it seems to have helped. I put this
right before the if:
$dom->validateOnParse=3Dtrue;
And now I get a false. It's still throwing the warning (which is strange
to me), but that can be handled...=20
-----Original Message-----
From: Bill Bolte [mailto:billb@hightouchinc.com]=20
Sent: Thursday, July 26, 2007 3:17 PM
To: php-windows@lists.php.net
Subject: [PHP-WIN] loadXML() strangeness
Maybe it's just me, but this isn't behaving as I think it should.
loadXML() is supposed to return T/F, depending on if it's succeeded or
not. and should throw a false if the XML isn't well-formed. however,
that's not what I'm seeing here. during some testing, the XML I'm trying
to load is blank (except for maybe a return), but it seems to be
returning true and trying to parse it. basically, all I'm doing is:
=20
if($dom->loadXML($fxml) == true){...}
and it appears that the code inside the if is running (I'm writing a
file out of the XML that's being parsed and it's showing up - although
it's empty). here's the warning that's being sent to the page:
Warning: DOMDocument::loadXML() [function.DOMDocument-loadXML]: Start
tag expected, '<' not found in Entity, line: 2 in
C:\www\op.dev\public_html\assets\inc\parser.php on line 278
Guess I could always check for a beginning <, but I assumed that
loadXML() would do this? what's the scoop here?
Bill
--=20
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php