Created
September 12, 2012 17:00
-
-
Save abhinavsingh/3708124 to your computer and use it in GitHub Desktop.
JAXLXml example for top() and up() api
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ./jaxlctl shell | |
jaxl 1> $xml_obj = new JAXLXml('message', 'jabber:client', array('to'=>'[email protected]')); | |
jaxl 2> echo $xml_obj->to_string(); | |
<message xmlns="jabber:client" to="[email protected]"></message> | |
jaxl 3> | |
jaxl 3> // after this operation rover will point to `body` child node | |
jaxl 3> $xml_obj->c('body'); | |
jaxl 4> echo $xml_obj->to_string(); | |
<message xmlns="jabber:client" to="[email protected]"><body></body></message> | |
jaxl 5> | |
jaxl 5> // this method will perform on `body` child node | |
jaxl 5> $xml_obj->t('Hello World!'); | |
jaxl 6> echo $xml_obj->to_string(); | |
<message xmlns="jabber:client" to="[email protected]"><body>Hello World!</body></message> | |
jaxl 7> | |
jaxl 7> // move rover one step up | |
jaxl 7> $xml_obj->up(); | |
jaxl 8> | |
jaxl 8> // if up() isn't performed above, `thread` child node would go as child of `body` node | |
jaxl 8> $xml_obj->c('thread'); | |
jaxl 9> $xml_obj->t('some thread id or name'); | |
jaxl 10> echo $xml_obj->to_string(); | |
<message xmlns="jabber:client" to="[email protected]"><body>Hello World!</body><thread>some thread id or name</thread></message> | |
jaxl 11> | |
jaxl 11> quit | |
$ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment