After XML is loaded to var xm, you can search it like this:
to retrieve nodeOne name
xm.test.nodeOne.nodNam()
to retrieve nodeOne value
xm.test.nodeOne.nodVal()
to retrieve nodeTwo name
xm.test.nodeTwo.nodNam()
to retrieve nodeTwo value
xm.test.nodeTwo.nodVal()
to retrieve name of 1st attribute in nodeTwo
xm.test.nodeTwo.attNam(1) or xm.test.nodeTwo.attNam() // couse 1st is default
to retrieve value of 1st attribute in nodeTwo
xm.test.nodeTwo.attNam(1) or xm.test.nodeTwo.attNam() // couse 1st is default
Also, you can retrieve nodes and values with numbers of their positions or
occurrence number, like this:
to retrieve name of 1st node
xm.test.__1.nodNam()
to retrieve value of 1st node
xm.test.__1.nodVal()
to retrieve name of 1st attribute in 2nd node
xm.test.__2.attNam(1)
to retrieve value of 1st attribute in 2nd node
xm.test.__2.attVal(1)
also you can retrieve it like this
xm.test.__2.__1.nodVal()
it is the same as
xm.test.nodeTwo.__1.nodVal()
or
xm.test.nodeTwo.subnodeTwo1.nodVal()
you can retrieve value of attribute by attribute name
xm.test.nodeTwo.attVal('nodeTwoAttr2')
etc ...
This prototype will read XML to any depth.
Now,
pay attention that nodeOne appears 4 times, so if you want to retrieve
3rd occurrence of nodeOne, you should do this:
xm.test.nodeOne__3.nodNam()
xm.test.nodeOne__3.nodVal()
There are many possibilities to retrieve XML, and most of them you will find in
cbx-xml_dot_reader_test.swi file.
attached file: cbx-xml_dot_reader_demo.zip, contains:
1. cbx-xml_dot_reader_test.html // html file
2. cbx-xml_dot_reader_test.swi // source file that will load files 3 & 4 and will read XML.
2a.cbx-xml_dot_reader_test.swf // swf file that will load files 3 & 4 and will read XML.
3. cbx-xml_dot_reader_demo.swf // demo swf file with dot reader prototype
4. cbx-xml_dot_reader_test.xml // xml file with test content
note 1: all swf, xml and html files must be in the same folder for test.
note 2: cbx-xml_dot_reader_demo.swf will display "http://cybernetix.t35.com" in your
main movie, to avoid this read note 3.
that's it, happy
SWiSHing
Download Example