Hallo,
in der Doku finde ich leider nicht die Konstruktor Beschreibung daher habe ich einfach mal den Klassennamen genommen zur Objekterstellung ohne Parameter genommen.
Folgender Code sollte doch eigentlich gehen oder?
PHP
$xml = new XMLWriter();
$xml->startDocument('1.0', 'UTF-8');
$xml->startElement('result');
$xml->writeElement('v1', $v1);
$xml->writeElement('v2', $v2);
$xml->writeElement('v3', $v3);
$xml->endElement(); //result
$xml->endDocument();
$xml->flush();
Doch PHP sagt mir:
Code
Warning: XMLWriter::startDocument() [function.XMLWriter-startDocument]: Invalid or unitialized XMLWriter object in C:\xampp\htdocs\test.php on line 25
Warning: XMLWriter::startElement() [function.XMLWriter-startElement]: Invalid or unitialized XMLWriter object in C:\xampp\htdocs\test.php on line 26
Warning: XMLWriter::writeElement() [function.XMLWriter-writeElement]: Invalid or unitialized XMLWriter object in C:\xampp\htdocs\test.php on line 27
Warning: XMLWriter::writeElement() [function.XMLWriter-writeElement]: Invalid or unitialized XMLWriter object in C:\xampp\htdocs\test.php on line 28
Warning: XMLWriter::writeElement() [function.XMLWriter-writeElement]: Invalid or unitialized XMLWriter object in C:\xampp\htdocs\test.php on line 29
Warning: XMLWriter::endElement() [function.XMLWriter-endElement]: Invalid or unitialized XMLWriter object in C:\xampp\htdocs\test.php on line 30
Warning: XMLWriter::endDocument() [function.XMLWriter-endDocument]: Invalid or unitialized XMLWriter object in C:\xampp\htdocs\test.php on line 31
Warning: XMLWriter::flush() [function.XMLWriter-flush]: Invalid or unitialized XMLWriter object in C:\xampp\htdocs\test.php on line 32
Alles anzeigen
Irgendwie scheint dort ja doch kein Objekt erstellt worden zu sein o.O.