php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40795 Unable to load the XML file
Submitted: 2007-03-13 17:29 UTC Modified: 2007-03-15 06:18 UTC
From: nags_chevula at us dot ibm dot com Assigned:
Status: Not a bug Package: DOM XML related
PHP Version: 4.4.6 OS: WIN XP
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: nags_chevula at us dot ibm dot com
New email:
PHP Version: OS:

 

 [2007-03-13 17:29 UTC] nags_chevula at us dot ibm dot com
Description:
------------
Unable to parse the following XMl file.

<?xml version="1.0"?>
<Contact>
  <Name>Nagarjun</Name>
  <Phone>111-222-3333</Phone>
</Contact>
<Contact>
  <Name>Debabrata</Name>
  <Phone>222-777-3333</Phone>
</Contact>
<Contact>
  <Name>Andrea</Name>
  <Phone>333-777-3333</Phone>
</Contact>
<Contact>
  <Name>Charlotte</Name>
  <Phone>444-777-3333</Phone>
</Contact>



I was able to parse the file
<?xml version="1.0"?>
<Contact>
  <Name>Nagarjun</Name>
  <Phone>111-222-3333</Phone>
</Contact>


Reproduce code:
---------------
$file = "C:/temp2/SNZ/input/testxml.xml";

if (!$DomDocument = domxml_open_file($file)){
 echo "Couldn't load xml...";
 exit;
}


Expected result:
----------------
I did not want to see the error "Couldn't load xml"

Actual result:
--------------
[13-Mar-2007 11:23:26] PHP Warning:  domxml_open_file() [<a href='function.domxml-open-file'>function.domxml-open-file</a>]: Extra content at the end of the document
 in C:\IBM\IBMHTTPServer\htdocs\en_US\Nags\ParseXMLFile1.php on line 12


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-03-13 18:39 UTC] chregu@php.net
Your XML is not well-formed. There's no single root element.

Clearly not a PHP issue
 [2007-03-13 20:04 UTC] nags_chevula at us dot ibm dot com
I know it is not a requirement to have a single root element. I can have multiple root elements based on DTD definition.

Does inclusion of DTD definition make my document well formed.

Correct me if I am wrong?

I am under the impression that I can have multiple root elements. I need to go back and read XML Specs.

I would appreciate your response.

thanks
Nags
 [2007-03-15 06:18 UTC] chregu@php.net
you can't have more than one root element. Please read the XML Specs.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 16 20:01:32 2025 UTC