jogisarge Posted September 20, 2010 Share Posted September 20, 2010 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 More sharing options...
Synook Posted September 20, 2010 Share Posted September 20, 2010 ... 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 More sharing options...
jogisarge Posted September 20, 2010 Author Share Posted September 20, 2010 ... 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 More sharing options...
Synook Posted September 20, 2010 Share Posted September 20, 2010 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 More sharing options...
boen_robot Posted September 20, 2010 Share Posted September 20, 2010 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.