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

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 155
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 134
ADOBE FLASH MEDIA INTERACTIVE SERVER
Server-Side ActionScript Language Reference
132
XML.namespaceURI
my_xml.namespaceURI
Read-only; if the XML node has a prefix, the value of the xmlns declaration for that prefix (the URI), which is
typically called the namespace URI. The
xmlns declaration is in the current node or in a node higher in the XML
hierarchy.
If the XML node does not have a prefix, the value of the
namespaceURI property depends on whether a default
namespace is defined (as in
xmlns="http://www.example.com/"). If there is a default namespace, the value of the
namespaceURI property is the value of the default namespace. If there is no default namespace, the namespaceURI
property for that node is an empty string (
"").
You c an u s e t h e
XML.getNamespaceForPrefix() method to identify the namespace associated with a specific
prefix. The
namespaceURI property returns the prefix associated with the node name.
Availability
Flash Media Server 2
Example
The following example shows how the
namespaceURI property is affected by the use of prefixes. The XML file used
in the example is named SoapSample.xml and contains the following tags:
<?xml version="1.0"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2001/12/soap-envelope">
<soap:Body xmlns:w="http://www.example.com/weather">
<w:GetTemperature>
<w:City>San Francisco</w:City>
</w:GetTemperature>
</soap:Body>
</soap:Envelope>
The source for the Server-Side ActionScript Communication File (ASC file) contains the following script (note the
comments for the Output strings). For
tempNode, which represents the w:GetTemperature node, the value of
namespaceURI is defined in the soap:Body tag. For soapBodyNode, which represents the soap:Body node, the
value of
namespaceURI is determined by the definition of the soap prefix in the node above it, rather than the
definition of the
w prefix that the soap:Body node contains.
var xmlDoc = new XML();
xmlDoc.load("http://www.example.com/SoapSample.xml");
xmlDoc.ignoreWhite = true;
xmlDoc.onLoad = function(success:Boolean) {
var tempNode:XMLNode = xmlDoc.childNodes[0].childNodes[0].childNodes[0];
trace("w:GetTemperature namespaceURI: " + tempNode.namespaceURI);
// Output: ... http://www.example.com/weather
trace("w:GetTemperature soap namespace: " + tempNode.getNamespaceForPrefix("soap"));
// Output: ... http://www.w3.org/2001/12/soap-envelope
var soapBodyNode = xmlDoc.childNodes[0].childNodes[0];
trace("soap:Envelope namespaceURI: " + soapBodyNode.namespaceURI);
// Output: ... http://www.w3.org/2001/12/soap-envelope
}:
The following example uses XML tags without prefixes. It uses a SWF file and an XML file located in the same
directory. The XML file, named NoPrefix.xml, contains the following tags:
<?xml version="1.0"?>
<rootnode>
Vedere la pagina 134
1 2 ... 130 131 132 133 134 135 136 137 138 139 140 ... 154 155

Commenti su questo manuale

Nessun commento