XML Basics | WebPelican:: XML basics. Assignment for learning the basics of XML. <strong> <em>This text is strong and emphased </em></strong> XML Documents have a Root Element http://www.webpelican.com/internet-programming-4/xml-basics/HOME | Hi,
Having issues getting the XML text assigned to the proper fields. "Undefined" is being returned. Any help would be appreciated.
//Create XML Object
var aquentDoc:XML = new XML();
aquentDoc.ignoreWhite = true;
//event handler
aquentDoc.onLoad = function(success:Boolean):Void {
if (!success) {
trace("Failure Loading aquentDoc XML");
return;
}
//validating the xml file
if (this.status != 0) {
trace("This xmlObject is not well-formed: "+this.status);
return;
}
//Error check - xml data okay!
if (this.firstChild.nodeName.toLowerCase() != "aquentdoc") { XML Flash Menu:: A tutorial showing you how to create a Flash menu, using xml for the button text be assigned a variable (Var), which will be used to reference the text, in order http://www.flash-game-design.com/flash-tutorials/xmlMenu-flash-tutorial.htmlHOME | C# XML Programming - Lesson 01: Introduction:: starts with <?xml version=, followed by the version you are using, assigned as a Creating an XML File With a Text Editor http://www.functionx.com/csharp1/xml/WndLesson01.htmHOME |
trace("Unexpected XML data: "+this.firstChild.nodeName);
return;
}
//Extract elements into an array.
var elements_arr = this.firstChild.childNodes;
for (var i = 0; i
//trace(elements_arr[i]);
if (elements_arr[i].attributes["id"] != null) {
var headers = elements_arr[i].attributes["id"];
//trace(headers);
assignText();
} else {
var content = elements_arr[i];
//trace(content);
}
}
};
//Load the document
aquentDoc.load("./aquentDoc.xml");
function assignText():Void {
for (var p in this) {
if (this[p] instanceof TextField) {
//Show each field's name
//trace("found "+this[p]._name);
if (this[p]._name == "header01_txt") {
header01_txt.text = elements_arr[0].attributes["id"]; CodeProject: Converting a List of Data to XML using Microsoft Excel :: Both are plain text file formats, and are common import/export options for An Excel list becomes exportable to XML when assigned an XML map. http://www.codeproject.com/KB/cpp/ExcelListToXml.aspx?display=PrintHOME |
} else if (this[p]._name == "header02_txt") {
header02_txt.text = elements_arr[1].attributes["id"];
} else if (this[p]._name == "header03_txt") {
header03_txt.text = elements_arr[2].attributes["id"];
}
}
}
}
var elements_arr = this.firstChild.childNodes;
var p;
for (var i = 0; i<15; i++) {
i<10 ? p="0"+i : p=i;
var tfd = this["header"+p+"_txt"];
trace(p);
tfd.text = elements_arr[i].attributes.id;
}
?
scotty(-:
Hi,
Thanks, however I'm a little unsure, how your suggestion should be implemented. The following attempt yielded unpredictable results in the output window.
//Create XML Object
var aquentDoc:XML = new XML();
aquentDoc.ignoreWhite = true;
//event handler
aquentDoc.onLoad = function(success:Boolean):Void {
if (!success) {
trace("Failure Loading aquentDoc XML");
return;
}
//validating the xml file
if (this.status != 0) {
trace("This xmlObject is not well-formed: "+this.status);
return;
}
//Error check - xml data okay!
if (this.firstChild.nodeName.toLowerCase() != "aquentdoc") {
trace("Unexpected XML data: "+this.firstChild.nodeName);
return;
}
//Extract elements into an array.
var elements_arr = this.firstChild.childNodes;
for (var i:Number = 0; i
//trace(elements_arr[i]);
if (elements_arr[i].attributes["id"] != null) {
var headers = elements_arr[i].attributes["id"];
trace(headers);
assignHeaders();
} else {
var content = elements_arr[i];
//trace(content);
}
}
};
//Load the document
aquentDoc.load("./aquentDoc.xml");
//assignText();
function assignHeaders():Void {
var elements_arr = this.firstChild.childNodes;
var p;
for (var i = 0; i<15; i++) {
i<10 ? p="0"+i : p=i;
var tfd = this["header"+p+"_txt"];
trace(p);
tfd.text = elements_arr[i].attributes.id;
}
}
var elements_arr = this.firstChild.childNodes;
var p;
for (var i = 0; i<15; i++) {
i<10 ? p="0"+i : p=i;
var tfd = this["header"+p+"_txt"];
trace(p);
tfd.text = elements_arr[i].attributes.id;
}
?
scotty(-:
Earnings Reports a Tonic for Ailing 'Net Stocks
NatWest and InterTrust Form Global Alliance To Provide E-Commerce On the Internet |