Re: SimpleXML addChild() namespace problem

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

 



On Jan 18, 2008 2:48 PM, Carole E. Mah <carole.mah@xxxxxxxxx> wrote:

> On Jan 18, 2008 12:22 PM, Nathan Nobbe <quickshiftin@xxxxxxxxx> wrote:
> > Are you trying to read an existing document into a SimpleXMLElement, or
> are
> > you trying to create a SimpleXMLElement instance and generate a document
> > from that?
> > My impression was you were trying to do the later; please clarify and if
> you
> > are trying to do the later, post the code you are using to create the
> > SimpleXMLElement instance and generate the output youve posted.
>
> Nathan,
>
> I am trying to to the latter -- create a SimpleXMLElement instance and
> generate
> a document from that.
>
> Thank you very much for all your examples and patience.
>
> I now see the very silly mistake I made.
>
> Correct (from your example):
>
> $xml = new SimpleXMLElement('<root xmlns:itunes="http://apple.com"/>');
> $n = $xml->addChild("subtitle", "Musical Mockery", " http://apple.com";);
>
> Incorrect (what I was doing):
>
> $xml = new SimpleXMLElement('<root xmlns:itunes="http://apple.com"/>');
> $n = $xml->addChild("subtitle", "Musical Mockery", " itunes");
>
> To be fair, there really isn't an example of this on PHP.net.
> Nonetheless, I feel a bit foolish for having wasted your time with
> this. Thank you for your help.


no prob; i learned how to do this on this post myself ;)
glad to hear its working now!

-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