FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » simplexml adding 'encoding' attribute to xml declaration
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
simplexml adding 'encoding' attribute to xml declaration [message #177182] Sat, 25 February 2012 03:17 Go to previous message
Basewind is currently offline  Basewind
Messages: 1
Registered: February 2012
Karma:
Junior Member
I'm creating an xml file using simplexml, but would like to add the encoding="UTF-8" to the XML declaration. Like this:

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

How can I do this?

Here's my code:

<?php
$namesXML = new SimpleXMLElement("<names></names>");
echo $namesXML->asXML();

This shows:

<?xml version="1.0" ?><!-- want the encoding attribute added here -->
<names/>

Thanks!
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Stats comp.lang.php (last 7 days)
Next Topic: Is there a way to distinguish an auto-refresh from a manual page load?
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Thu Nov 28 03:05:43 GMT 2024

Total time taken to generate the page: 0.03691 seconds