I'm working on a PostgreSQL to XML converter. Which should extract the values of different Tables. The relevant code below:
$xml = new XMLWriter();
$xml->openMemory();
$xml->setIndent(true);
$xml->startDocument();
$query = new data_DataBaseQuery();
$xml->startElement();
.......
$xml->endElement();
And if I use echo htmlentities($xml->outputMemory());
I get as output what I want.
But I'd like to make the exported file donwloadable with a specicic name.
Can you help me at this point?
$xml->openURI('test.xml');
...
$xml->flush();
Doesn't work somehow. It leads me only to a empty page with the output.But if this would be the proper method, can someone explain it to me?
Thank you in advance
You can output the content in a file with the openURI()
method. And after that you will be able to download it. Use it instead of openMemory()
.
$xml = new XMLWriter();
$xml->openURI("test.xml");
$xml->setIndent(true);
$xml->startDocument();
$query = new data_DataBaseQuery();
$xml->startElement();
.......
$xml->endElement();
$xml->flush();