Export to GitHub

simpledom - issue #3

AppendElement


Posted on Dec 4, 2010 by Helpful Camel

Hello,

i am missing a function to insert or append a Element like this Szenario:

$toInsert=new SimpleDOM('<insertme><manynodes/></insertme>'); $main=new SimpleDOM('<main><something/></main>');

Expected result: <main><something><insertme><manynodes/></insertme></something></main>

Thanks!

Comment #1

Posted on Dec 4, 2010 by Happy Kangaroo

Comment deleted

Comment #2

Posted on Dec 4, 2010 by Helpful Camel

Comment deleted

Comment #3

Posted on Dec 4, 2010 by Swift Hippo

You can append nodes using DOM's appendChild(), which is one of the basic DOM methods supported by SimpleDOM:

$main->something->appendChild($toInsert);

Comment #4

Posted on Dec 4, 2010 by Helpful Camel

Ah okay thanks.. I didnot get that you extend the appendChild function too! Thanks for your help, sorry for troubling you!

Comment #5

Posted on Dec 4, 2010 by Swift Hippo

No worries, it's my fault for not providing a half decent documentation ^_^;

If you look into SimpleDOM.php you'll see the list of DOM methods that are directly supported by SimpleDOM. Most of DOMNode and DOMElement methods are supported.

Status: Invalid

Labels:
Type-Enhancement Priority-Medium