On Jan 14, 2008 11:21 PM, Carole E. Mah <[EMAIL PROTECTED]> wrote:

> Yes, I tried the following:
>
> http://us3.php.net/manual/en/function.dom-domdocument-createelementns.php
>
> Same results.
>


based upon information from bug #43221, if you define the namespace
beforehand
it will work.

<?php
$xml = new SimpleXMLElement('<root xmlns:itunes="http://apple.com"/>');
$n = $xml->addChild("subtitle", "Musical Mockery", "http://apple.com";);
print_r($xml->asXml());
?>

produces:
<?xml version="1.0"?>
<root xmlns:itunes="http://apple.com";><itunes:subtitle>Musical
Mockery</itunes:subtitle></root>

-nathan

Reply via email to