
ADOBE FLASH MEDIA INTERACTIVE SERVER
Server-Side ActionScript Language Reference
127
for (var aNode = my_xml.firstChild.firstChild; aNode != null; aNode=aNode.nextSibling) {
if (aNode.nodeType == 1) {
trace(aNode.nodeName+":\t"+aNode.firstChild.nodeValue);
}
}
}
The following output appears:
username:hank
password:rudolph
XML.ignoreWhite
my_xml.ignoreWhite
XML.prototype.ignoreWhite
When set to true, discards, during the parsing process, text nodes that contain only white space. The default setting
is
false. Text nodes with leading or trailing white spaces are unaffected.
Usage 1: You can set the
ignoreWhite property for individual XML objects, as shown in the following code:
my_xml.ignoreWhite = true;
Usage 2: You can set the default ignoreWhite property for XML objects, as shown in the following code:
XML.prototype.ignoreWhite = true;
Availability
Flash Media Server 2
Example
The following example loads an XML file with a text node that contains only white space; the
foyer tag contains 14
space characters. To run this example, create a text file named flooring.xml and copy the following tags into it:
<house>
<kitchen> ceramic tile </kitchen>
<bathroom> linoleum </bathroom>
<foyer></foyer>
</house>
The following is the server-side code:
// Create a new XML object.
var flooring = new XML();
// Set the ignoreWhite property to true (the default value is false).
flooring.ignoreWhite = true;
// After loading is complete, trace the XML object.
flooring.onLoad = function(success) {
trace(flooring);
}
// Load the XML into the flooring object.
flooring.load("flooring.xml");
/* output (line breaks added for clarity):
<house>
<kitchen>ceramic tile</kitchen>
<bathroom>linoleum</bathroom>
</foyer>
Commenti su questo manuale