Flash call XML data concise tutorial

xiaoxiao2021-03-06  100

First, establish an XML object:

Var myxml = new xml ();

Second, the reference XML file:

MyXml.Load ("DATA.XML");

Third, ignore spaces:

MyXML.IgnoreWhite = true; // default for false

Functions to process XML objects: myXml.onload = function (success) {statements;} 5, data.xml file content: xiaoshandong3 six, return value instance 1, myXml.childNodes [0] will return: xiaoshandong3

2, myXml.childNodes [0] .NodeName will return:

Data1

3, myXml.childnodes [0] .childnodes [0] .name will return:

ImageBear

4, myxml.childnodes [0] .childNodes [0] will return:

xiaoshandong

5, myxml.childnodes [0] .childnodes [0] .NodeName will return:

Data2

6, myxml.childnodes [0] .childnodes [1] .attributes.name will return:

Mariger3

7, myXml.childnodes [0] .childnodes [0] .childnodes [0] .NodeValue will return:

xiaoshandong

8, var myname = myXml.firstchild.firstchild;

Trace (MyName.NodeName); will output DATA2

MyName = myname.nextsibling;

TRACE (MyName.NodeName); Data3ChildNodes [0] is equivalent to firstchild

转载请注明原文地址:https://www.9cbs.com/read-123820.html

New Post(0)