MACROMEDIA FLASH MEDIA SERVER 2-SERVER-SIDE ACTIONSCRIPT LANGUAGE Reference page 185

Server-side actionscript language reference
Table of Contents

Advertisement

Example
The following example creates a very simple XML object and outputs the result of a call to the
getPrefixForNamespace()
variable, defines a namespace URI and assigns it to the exu prefix. Calling the
xmlDoc
getPrefixForNamespace()
www.example.com/util") returns the prefix exu, but calling this method with an undefined
URI ("http://www.example.com/other") returns null. The first exu:Child node, which is
represented by the child1 variable, also defines a namespace URI ("http://www.example.com/
child"), but does not assign it to a prefix. Calling this method on the defined, but unassigned,
namespace URI returns an empty string.
function createXML() {
var str = "<Outer xmlns:exu=\"http://www.example.com/util\">"
+ "<exu:Child id='1' xmlns=\"http://www.example.com/child\"/>"
+ "<exu:Child id='2' />"
+ "<exu:Child id='3' />"
+ "</Outer>";
return new XML(str).firstChild;
}
var xmlDoc = createXML();
trace(xmlDoc.getPrefixForNamespace("http://www.example.com/util")); //
output: exu
trace(xmlDoc.getPrefixForNamespace("http://www.example.com/other")); //
output: null
var child1 = xmlDoc.firstChild;
trace(child1.getPrefixForNamespace("http://www.example.com/child")); //
output: [empty string]
trace(child1.getPrefixForNamespace("http://www.example.com/other")); //
output: null
See also
XML.getNamespaceForPrefix()
method. The Outer XML node, which is represented by the
method with the defined namespace URI ("http://
XML class
185

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH MEDIA SERVER 2-SERVER-SIDE ACTIONSCRIPT LANGUAGE and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flash media server 2

Table of Contents