Jump to content

PHP - DomImplementation


jogisarge

Recommended Posts

Hi,i generate a XML-file using the following Code:

$document=DOMImplementation::createDocument();$document->encoding='UTF-8';$document->standalone='no';		$document->formatOutput = TRUE;...$document->save("./test.xml");

the generated XML looks like:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>...

Now in want to habe a blank between standalone="no" and ?> The header has to look like :

<?xml version="1.0" encoding="UTF-8" standalone=[b]"no" ?>[/b]...

Can anybody tell me how to get this?bye jo

Link to comment
Share on other sites

... why? That whitespace is completely transparent to XML parsers - the easiest way to get it in there would probably be to use string replacing functions.

Link to comment
Share on other sites

... why? That whitespace is completely transparent to XML parsers - the easiest way to get it in there would probably be to use string replacing functions.
You are right.i don't understand, why i should do this.the company,that use my files, needs it.They say, there parser won't work without it.
Link to comment
Share on other sites

That's one odd parser :) - anyway, as I said, you can always modify the file's contents after you've written the XML:

$xml = file_get_contents("test.xml");$xml = str_replace("?>", " ?>", $xml);file_put_contents("test.xml", $xml);

Link to comment
Share on other sites

the company,that use my files, needs it.They say, there parser won't work without it.
Could you possibly ask them what their parser is, and/or reccomend upgrade/change? The "parser" is clearly custom built (and isn't really a parser), or is a really old non-conformant one.
Link to comment
Share on other sites

Archived

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

×
×
  • Create New...