Jump to content

XMLWriter problem


franbm

Recommended Posts

i have this code:

$xml = new XMLWriter();

$xml->openUri('test.xml');

$xml->setIndent(true);

$xml->setIndentString("\t");

$xml->startDocument();

$xml->startElement('inventory');

$xml->startElement('book');

$xml->writeAttribute('isbn13', '978-1-43021-011-5');

$xml->writeElement('title', 'c++');

$xml->writeElement('author', 'David deers');

$xml->endElement();

$xml->startElement('book');

$xml->writeAttribute('isbn13', '978-1-59059-819-1');

$xml->writeElement('title', 'asp.net');

$xml->writeElement('author', 'Kevin Mcder');

$xml->endElement();

$xml->endElement();

$xml->endDocument();

if ($xml->flush()) {

    echo 'XML created';

} else {

    echo 'Problem with XML';

}

i have tested windows/linux i always get 'Problem with XML' text but the file

test.xml is well created on the server with valid data, on both windows/linux,

where's the problem, is it not a correct code,

thanks a lot

Link to comment
https://forums.phpfreaks.com/topic/154676-xmlwriter-problem/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.