SimpleXML addChild() namespace problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is problematic code, even though it works, because it
auto-generates an unnecessary xmlns: attribute:

$item->addChild('itunes:subtitle', $mySubTitle,"itunes");

It generates the following XML:

<itunes:subtitle xmlns:itunes="itunes">Musical Mockery</itunes:subtitle>

When really all we want is this:

<itunes:subtitle>Musical Mockery</itunes:subtitle>

Furthermore, dumping it into a DomDocument and attempting to use
removeAttributeNS() to remove the spurious attribute removes the
entire kit and kaboodle, leaving only:

<subtitle>Musical Mockery</subtitle>

How can one get the desired result, short of using a regexp? (I have
done this, and it works, but is a silly hack because it doesn't use
XML parsing to address an XML problem).

Thanks,

Carole

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux