Page 1 of 1

XmlWriter Issue

Posted: Tue Mar 03, 2009 12:06 pm
by fairyprincess18
I'm trying to use PHP to generate an xml document using the XmlWriter class and am getting the following error:

XML Parsing Error: junk after document element
Location: http://my.wiscnet.net/mashups/imgtoxml.php?
Line Number 2, Column 1:

<table border='1' cellspacing='0'>
^

Here's my code:

Code: Select all

 
<?php
    //begin xml file generation to store marker info
    header('Content-type: application/xml');
    $xml = new XmlWriter();
    $xml->openMemory();
    $xml->startDocument('1.0', 'UTF-8');
    $xml->startElement('markers');
 
    //write xml element
    $xml->startelement('marker');
    $xml->writeCData("some text");
    $xml->endElement();
 
    //end of document and output
    $xml->endElement();
    $xml->endElement();
    echo $xml->outputMemory(true);
?>
 
Anyone know what's wrong?

Re: XmlWriter Issue

Posted: Tue Mar 03, 2009 12:23 pm
by ben.artiss
Is HTML allowed in XML? You might want to check the class to see what it's outputting- or is it one of those classes you dare not look at in fear of your eyes bleeding?