Example
The following example creates a very simple XML object and outputs the result of a call to
getNamespaceForPrefix()
function createXML() {
var str = "<Outer xmlns:exu=\"http://www.example.com/util\">"
+ "<exu:Child id='1' />"
+ "<exu:Child id='2' />"
+ "<exu:Child id='3' />"
+ "</Outer>";
return new XML(str).firstChild;
}
var xml = createXML();
trace(xml.getNamespaceForPrefix("exu")); // output: http://www.example.com/
util
trace(xml.getNamespaceForPrefix("")); // output: null
See also
XML.getPrefixForNamespace()
XML.getPrefixForNamespace()
Availability
Flash Media Server 2.
Usage
my_xml.getPrefixForNamespace(nsURI)
Parameters
A String; the namespace URI for which the method returns the associated prefix.
nsURI
Returns
A String; the prefix associated with the specified namespace.
Description
Method; returns the prefix that is associated with the specified namespace URI for the node.
To determine the prefix,
the node, as necessary, and returns the prefix of the first xmlns declaration with a namespace
URI that matches
nsURI
If there is no xmlns assignment for the given URI, the method returns null. If there is an
xmlns assignment for the given URI but no prefix is associated with the assignment, the
method returns an empty string (
184
Server-Side ActionScript Language Reference
:
getPrefixForNamespace()
.
).
""
searches up the XML hierarchy from
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?