MACROMEDIA FLASH MEDIA SERVER 2-SERVER MANAGEMENT ACTIONSCRIPT LANGUAGE Instrukcja Użytkownika Strona 139

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 155
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 138
ADOBE FLASH MEDIA INTERACTIVE SERVER
Server-Side ActionScript Language Reference
136
The node value of the XML object. If the XML object is a text node, the nodeType is 3, and the nodeValue is the text
of the node. If the XML object is an XML element (
nodeType is 1), nodeValue is null and read-only.
Availability
Flash Media Server 2
Example
The following example creates an element node and a text node and checks the node value of each:
// Create an XML document.
var doc = new XML();
// Create an XML node by using createElement().
var myNode = doc.createElement("rootNode");
// Place the new node into the XML tree.
doc.appendChild(myNode);
// Create an XML text node by using createTextNode().
var myTextNode = doc.createTextNode("myTextNode");
// Place the new node into the XML tree.
myNode.appendChild(myTextNode);
trace(myNode.nodeValue);
trace(myTextNode.nodeValue);
/*
output:
null
myTextNode
*/
The following example creates and parses an XML packet. The code loops through each child node and displays the
node value by using the
firstChild property and firstChild.nodeValue.
var my_xml = new
XML("<login><username>morton</username><password>good&amp;evil</password></login>");
trace("using firstChild:");
for (var i = 0; i<my_xml.firstChild.childNodes.length; i++) {
trace("\t"+my_xml.firstChild.childNodes[i].firstChild);
}
trace("");
trace("using firstChild.nodeValue:");
for (var i = 0; i<my_xml.firstChild.childNodes.length; i++) {
trace("\t"+my_xml.firstChild.childNodes[i].firstChild.nodeValue);
}
The following information is written to the log file:
using firstChild:
morton
good&evil
using firstChild.nodeValue:
morton
good&evil
Przeglądanie stron 138
1 2 ... 134 135 136 137 138 139 140 141 142 143 144 ... 154 155

Komentarze do niniejszej Instrukcji

Brak uwag