Skip to content

Instantly share code, notes, and snippets.

@abhinavsingh
Created September 12, 2012 16:49
Show Gist options
  • Save abhinavsingh/3708041 to your computer and use it in GitHub Desktop.
Save abhinavsingh/3708041 to your computer and use it in GitHub Desktop.
JAXLXml example for appending a child node using cnode($node) api
$ ./jaxlctl shell
jaxl 1> $xml_obj = new JAXLXml('message', 'jabber:client', array('to'=>'myfriend@gmail.com'));
jaxl 2> echo $xml_obj->to_string();
<message xmlns="jabber:client" to="myfriend@gmail.com"></message>
jaxl 3>
jaxl 3> $child = new JAXLXml('body', null, array(), 'Hello World!');
jaxl 4> echo $child->to_string();
<body>Hello World!</body>
jaxl 5>
jaxl 5> $xml_obj->cnode($child);
jaxl 6> echo $xml_obj->to_string();
<message xmlns="jabber:client" to="myfriend@gmail.com"><body>Hello World!</body></message>
jaxl 7>
jaxl 7> quit
$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment