MACROMEDIA FLASH MEDIA SERVER 2-SERVER MANAGEMENT ACTIONSCRIPT LANGUAGE Manuale Utente Pagina 143

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 155
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 142
ADOBE FLASH MEDIA INTERACTIVE SERVER
Server-Side ActionScript Language Reference
140
var my_xml = new
XML("<login><username>morton</username><password>good&amp;evil</password></login>");
// The first child is the <login /> node.
var rootNode = my_xml.firstChild;
// The first child of the root is the <username /> node.
var targetNode = rootNode.firstChild;
trace("the parent node of '"+targetNode.nodeName+"' is: "+targetNode.parentNode.nodeName);
trace("contents of the parent node are:\n"+targetNode.parentNode);
/* output (line breaks added for clarity):
the parent node of 'username' is: login
contents of the parent node are:
<login>
<username>morton</username>
<password>good&amp;evil</password>
</login>
*/
XML.parseXML()
my_xml.parseXML(source)
Parses the XML text specified in the source parameter and populates the specified XML object with the resulting
XML tree. Any existing trees in the XML object are discarded.
Availability
Flash Media Server 2
Parameters
source A string; the XML text to be parsed and passed to the specified XML object.
Returns
A boolean value;
true if successful, otherwise, false.
Example
The following example creates and parses an XML packet:
var xml_str = "<state name=\"California\"><city>San Francisco</city></state>"
// Defining the XML source within the XML constructor:
var my1_xml = new XML(xml_str);
trace(my1_xml.firstChild.attributes.name); // output: California
// Defining the XML source by using the XML.parseXML method:
var my2_xml = new XML();
my2_xml.parseXML(xml_str);
trace(my2_xml.firstChild.attributes.name);
// output: California
XML.prefix
my_xml.prefix
Vedere la pagina 142
1 2 ... 138 139 140 141 142 143 144 145 146 147 148 ... 154 155

Commenti su questo manuale

Nessun commento