XmlWriter Issue
Posted: Tue Mar 03, 2009 12:06 pm
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:
Anyone know what's wrong?
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);
?>