Created
September 12, 2012 17:10
-
-
Save abhinavsingh/3708233 to your computer and use it in GitHub Desktop.
JAXLXml chaining api methods example
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', array('to'=>'[email protected]', 'from'=>'[email protected]')); | |
jaxl 2> $xml_obj->c('body')->attrs(array('xml:lang'=>'en'))->t('Hello World!')->up() | |
....... ->c('thread')->t('id-1234')->up() | |
....... ->c('nested-stuff') | |
....... ->c('nest')->t('nest1')->up() | |
....... ->c('nest')->t('nest2')->up() | |
....... ->c('nest')->t('nest3')->up()->up() | |
....... ->c('c')->attrs(array('hash'=>'84jsdmnskd')); | |
jaxl 3> echo $xml_obj->to_string(); | |
'<message to="[email protected]" from="[email protected]"><body xml:lang="en">hello</body><thread>1234</thread><nested><nest>nest1</nest><nest>nest2</nest><nest>nest3</nest></nested><c hash="84jsdmnskd"></c></message>' | |
jaxl 4> | |
jaxl 4> quit | |
$ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment