Skip to content

Instantly share code, notes, and snippets.

@abhinavsingh
Created September 12, 2012 16:41
Show Gist options
  • Save abhinavsingh/3707985 to your computer and use it in GitHub Desktop.
Save abhinavsingh/3707985 to your computer and use it in GitHub Desktop.
JAXLXml example for adding a child node using c($name, $ns, $attrs, $text) 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> $xml_obj->c('body', null, array(), 'Hello World!');
jaxl 4> echo $xml_obj->to_string();
<message xmlns="jabber:client" to="myfriend@gmail.com"><body>Hello World!</body></message>
jaxl 5>
jaxl 5> quit
$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment