196
Server-Side ActionScript Language Reference
The source for the server-side 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("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>
<simplenode xmlns="http://www.w3.org/2001/12/soap-envelope">
<innernode />
</simplenode>
</rootnode>
The source for the server-side script file contains the following code (note the comments for
the Output strings). The
rootNode
does not have a default namespace, so its
namespaceURI
value is an empty string. The
simpleNode
defines a default namespace, so its
namespaceURI
value is the default namespace. The
innerNode
does not define a default namespace, but uses
the default namespace defined by
simpleNode
, so its
namespaceURI
value is the same as that
of
simpleNode
.
var xmlDoc = new XML()
xmlDoc.load("NoPrefix.xml");
xmlDoc.ignoreWhite = true;
xmlDoc.onLoad = function(success)
{
var rootNode = xmlDoc.childNodes[0];
Содержание FLASH MEDIA SERVER 2
Страница 1: ...Server Side ActionScript Language Reference...
Страница 4: ...4 Contents...
Страница 228: ...228 Server Side ActionScript Language Reference...
Страница 234: ...234 Server Side Information Objects...