xml_each - Return or loop threw all children of current node.
xml_each(xml:string, [text_node:true|false,error:variable]);
This function return all children of current node as an array.
If use as a callback function, return each node for each loop.
To use this module, you must specify the following in /usr/local/website/site.conf:
Module xml { Library : "/usr/local/lib/libsnxml.so" Init : "snxml_init" }
res=<{ xml=xml_new(error:t,file:"/html/test.xml"); %include "/includes/xml.sn"; for l xml_each(xml:xml) l.xml_name(); l.xml_attr(); endfor xml_free(xml); }>. return res=fn\[{"id":"1"},{"class":"pierre"}\]fn\[{"id":"2"},{"class":"chantal"}\]. res=<{ xml=xml_new(error:t,file:"/html/test.xml"); %include "/includes/xml.sn"; l = xml.xml_each(); node = l[0]; node.xml_name(); node = l[1]; node.xml_name(); for i in l do i.xml_name(); i.xml_type(); endfor; xml_free(xml); }>. return res=fnfnfn1fn1.
Written by Pierre Laplante, <laplante@sednove.com>
Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin commodo. Cras purus odio, vestibulum in vulputate at, tempus viverra turpis.
1.0 2014-09-09 21:24:14 laplante@sednove.com