Re: SimpleXML addChild() namespace problem

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

 



On Jan 14, 2008 10:22 PM, Carole E. Mah <carole.mah@xxxxxxxxx> wrote:

> 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).


have you considered appending the child w/ w/e the DOM extension
has, just to see if the namespace specification is unintentionally added
by it as well?

-nathan

[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