Flash calls XML data code instance tutorial

Source: Internet
Author: User

Flash calls XML data code instance tutorial

How flash calls XML data: Create an XML object: var myxml = new XML ();
Referencing XML file: Myxml.load ("Data.xml");
Ignore spaces: Myxml.ignorewhite = true;//default is False

functions to process XML objects: Myxml.onload = function (success) {statements;}

Data. Contents of XML file: Xiaoshandong xiaoshandong3
Myxml.childnodes[0] will return: Xiaoshandong xiaoshandong3
Myxml.childnodes[0].nodename will return: data1
Myxml.childnodes[0].childnodes[0].name will return: Imagebear
Myxml.childnodes[0].childnodes[0] will return: Xiaoshandong
Myxml.childnodes[0].childnodes[0].nodename will return: data2
Myxml.childnodes[0].childnodes[1].attributes.name will return: Mariger3
Myxml.childnodes[0].childnodes[0].childnodes[0].nodevalue will return: Xiaoshandong
var myname = Myxml.firstchild.firstchild;trace (myname.nodename); Output Data2myname = Myname.nextsibling;trace ( myname.nodename); will output data3
Childnodes[0] equivalent to FirstChild

Height method

The XML file is shown as an upstairs var myxml = new XML ();
Myxml.load ("Data.xml");
Myxml.ignorewhite = true;
Myxml.onload = function (Success) {if (success) {
MyArray = Myxml.childnodes[0];
Trace (MyArray.attributes.name);
Trace (Myxml.childnodes[0].childnodes[1].firstchild.nodevalue);
Trace (Myxml.firstchild);
Trace (Myxml.childnodes[0].nodename);
Trace (MyXML.firstChild.attributes.name);
Trace (Myxml.childnodes[0].childnodes[1].nodename);
Trace (Myxml.childnodes[0].childnodes[1].attributes.name);
Trace (MyXML.firstChild.firstChild);
Trace (MyXML.firstChild.firstChild.nodeName);
Trace (MyXML.firstChild.firstChild.attributes.name);
Trace (Myxml.childnodes[0].childnodes[0].childnodes[0].nodevalue);
var myname = MyXML.firstChild.firstChild; Trace (Myname.nodename); MyName = myname.nextsibling; Trace (Myname.nodename); }


}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.