View Full Version : DOMDocument::xmlStandalone defined to be TRUE by default?

11-15-2007, 03:31 AM
Hi, I use a simple script to get the various elements of the XML PI, but apparently it goes against the XML spec as well as Firefox's JavaScript implementation of the DOM. The problem seems to be that DOMDocument::xmlStandalone seems to be defined as TRUE by default.

However, the spec says that it shouldn't be considered standalone because I never specified that it was or was not standalone.

Firefox's DOM says that it defaults to 'standalone="no"' (false), but PHP's DOMDocument::xmlStandalone outputs TRUE (standalone="yes"). Is this a bug in the XML parser?

A sample XML document with sample PHP code -

<?xml version="1.0" encoding="utf-8" ?>
<bar />

$doc = new DOMDocument();
if (!$doc->load('./example.xml'))
die("Couldn't load document.");
echo 'standalone="', ($doc->xmlStandalone === FALSE) ? 'no' : 'yes', '"';