domxml_open_mem(): Extra content at the end of the document

Discussion in 'PHP' started by Hade, Aug 15, 2007.

  1. #1
    I'm loading an XML document and then parsing it.
    This script works fine of all of my clients except 1.

    His domxml_open_mem() function dies, saying:
    Extra content at the end of the document

    So I checked the XML file and the end looks like this:

    </Question>
    </ResultSet>
    <!--
     ws02.search.re2.yahoo.com compressed/chunked Wed Aug 15 04:09:16 PDT 2007 
    -->
    Code (markup):
    So I added the foll0owing gode to remove that comment:
    // Remove any trailing content.
    	$endpos=strpos($xml,'</ResultSet>');
    	$endpos=$endpos+12;
    	$xml=substr($xml,0,$endpos);
    PHP:
    So now the end of the XML document looks like this (as it should):

    </Question>
    </ResultSet>
    Code (markup):
    But he's still getting the same error.
    What is his DOMXML not liking about the end of the XML document that no others mind?
     
    Hade, Aug 15, 2007 IP
  2. Hade

    Hade Active Member

    Messages:
    701
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    90
    #2
    Sussed it. It wan't even retrieving the XML document as allow_url_fopen() was disabled!
     
    Hade, Aug 15, 2007 IP