|
Posted by frodo2000@gmail.com on 07/16/07 11:11
On 16 Lip, 11:36, David Gillen <Bel...@RedBrick.DCU.IE> wrote:
> Hello.
>
> I'm looking to create xml like the following
>
> <node>
> <otherNode>foo</otherNode>
> <otherNode>bar</otherNode>
> <otherNode>moo</otherNode>
> </node>
> via the simple xml interface.
> Unfortunately I cannot figure out how to create multiple nodes with the same
> name as children of the parent, sibling as it were. Is this actually possible
> using PHPs simple xml extension?
>
> Doing
> $node->otherNode = foo;
> $node->otherNode = bar;
> etc just overwrite the previous value.
>
> Thanks,
> D.
> --
> Fermat was right.
Try
$node->otherNode = array();
$node->otherNode[] = foo;
$node->otherNode[] = bar;
or use addChild function: http://uk3.php.net/manual/pl/function.simplexml-element-addChild.php
----
Marcin
Navigation:
[Reply to this message]
|