#43622 [Opn->Bgs]: Failed to parse document!
| From: | felipe@php.net | Date: | Tue, 18 Dec 2007 12:15:16 +0000 |
| Subject: | #43622 [Opn->Bgs]: Failed to parse document! | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-120730@lists.php.net to get a copy of this message | ||
ID: 43622
Updated by: felipe@php.net
Reported By: cj at dafolo dot dk
-Status: Open
+Status: Bogus
Bug Type: SimpleXML related
Operating System: FreeBSD
PHP Version: 5.2.5
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
Hi,
Use the fourth paramater of the function.
E.g.:
$document = simplexml_load_string($string, null, null,
'http://www.fujitsu.dk/esdh/xml/schemas/2007/01/14/');
Previous Comments:
------------------------------------------------------------------------
[2007-12-18 11:15:18] cj at dafolo dot dk
Description:
------------
Failed to parse document with namespace
Reproduce code:
---------------
<?xml version="1.0" encoding="utf-8"?>
<Root
xmlns:edoclist="http://www.fujitsu.dk/esdh/xml/schemas/2007/01/14/">
<edoclist:ArchiveFormats>
<edoclist:ArchiveFormat>
<edoclist:ArchiveFormatCode>1</edoclist:ArchiveFormatCode>
<edoclist:ArchiveFormatFileExtension>DOC</edoclist:ArchiveFormatFileExtension>
<edoclist:ArchiveFormatMimetype>application/msword</edoclist:ArchiveFormatMimetype>
</edoclist:ArchiveFormat>
</edoclist:ArchiveFormats>
</Root>
$string =
file_get_contents('http://mygreeceholiday.discoball.pil.dk/webservice/ArchiveFormat-result.xml');
$document = simplexml_load_string($string);
if (!$document){
echo "Failed to parse document!\n";
}
else{
print_r($document);
}
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=43622&edit=1