Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    Regular Coder
    Join Date
    Mar 2005
    Location
    D0u$h!t3 k4?
    Posts
    512
    Thanks
    2
    Thanked 5 Times in 5 Posts

    DOMDocument::xmlStandalone defined to be TRUE by default?

    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?

    Edit:
    A sample XML document with sample PHP code -
    Code:
    <?xml version="1.0" encoding="utf-8" ?>
    <foo>
        <bar />
    </foo>
    Code:
    <?php
    
    $doc = new DOMDocument();
    if (!$doc->load('./example.xml'))
        die("Couldn't load document.");
    echo 'standalone="', ($doc->xmlStandalone === FALSE) ? 'no' : 'yes', '"';
    
    ?>
    Last edited by rpgfan3233; 11-15-2007 at 03:47 AM. Reason: Added sample code
    PHP Code:
    $hello file_get_contents('hello.txt'); echo $hello
    hello


 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •