php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29684 Error loading XML or XSL files with DomXML
Submitted: 2004-08-15 00:52 UTC Modified: 2004-08-15 10:31 UTC
From: powerblade at mail dot dk Assigned:
Status: Not a bug Package: DOM XML related
PHP Version: 5CVS-2004-08-15 (dev) OS: Windows XP
Private report: No CVE-ID: None
 [2004-08-15 00:52 UTC] powerblade at mail dot dk
Description:
------------
PHP simply won't load the XML file.
Whenever it loads the file, it seems like it empties it out.
I think they have the same problem here:
http://mail.gnome.org/archives/xml/2001-June/msg00153.html

Reproduce code:
---------------
index.php:

<?php


$oXML = new domdocument();
$oXML->loadXML('example.xml');
echo "done...";
?>

example.xml:

<?xml version="1.0" encoding="UTF-8"?> 
<topic subject="Topic subject" tid="1">
	<posts>
		<post pid="1" mid="1" cdate="01-02-2003" mdate="05-04-2004" username="PowerBlade">
		Blah blah blah
		</post>
	</posts>
</topic>


Expected result:
----------------
done...

Actual result:
--------------
Warning: DOMDocument::loadXML() [function.loadXML]: Start tag expected, '<' not found in Entity, line: 1 in W:\Apache2\htdocs\test\index.php on line 5
done...

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-08-15 04:35 UTC] amt@php.net
Have you tried using the load() method instead of 
loadXML()? DomDocument::loadXML() is for XML from a 
string, while load() is from a file. You're trying to 
parse the string 'example.com'
 [2004-08-15 10:32 UTC] powerblade at mail dot dk
Ops.. Sorry.. My fault, your right
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 09:01:28 2024 UTC