By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,650 Members | 1,778 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,650 IT Pros & Developers. It's quick & easy.

save XML without XML Prolog

Expert Mod 5K+
P: 8,639

I'm trying to save a xhtml snippet to file. Is there a way besides fwrite() to save an xml string without the xml prolog (e.g. DOMDocument::save() automatically inserts the xml prolog)?

note: the string to save doesn't contain the prolog.

Dec 27 '08 #1
Share this Question
Share on Google+
4 Replies

Expert 5K+
P: 5,058
The file_put_contents function perhaps?

Or am I not getting the problem?
Dec 27 '08 #2

Expert 5K+
P: 5,821
Heya, Dormi.

Try using DOMDocument::saveXML() instead, and run a substr() on it if necessary.
Dec 27 '08 #3

Expert Mod 5K+
P: 8,639
file_put_contents() looks good. I'll try that.

@pbmods: I already have the string, I only need saving.

thanks Atli
Dec 27 '08 #4

Expert Mod 5K+
P: 8,639
tried file_put_contents(). it works really well (much less coding than fwrite()).

thanks for the quick help, anyway.
Dec 27 '08 #5

Post your reply

Sign in to post your reply or Sign up for a free account.