MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE Reference page 1322

Actionscript 2.0 language reference
Table of Contents

Advertisement

getNamespaceForPrefix
(XMLNode.getNamespaceForPrefix method)
public getNamespaceForPrefix(prefix:String) : String
Returns the namespace URI that is associated with the specified prefix for the node. To
determine the URI,
getPrefixForNamespace()
node, as necessary, and returns the namespace URI of the first
.
prefix
If no namespace is defined for the specified prefix, the method returns
If you specify an empty string (
the node (as in
xmlns="http://www.example.com/"
namespace URI.
Availability: ActionScript 1.0; Flash Player 8
Parameters
- The prefix for which the method returns the associated namespace.
prefix:String
Returns
- The namespace that is associated with the specified prefix.
String
Example
The following example creates a very simple XML object and outputs the result of a call to
getNamespaceForPrefix()
function createXML():XMLNode {
var str:String = "<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:XMLNode = createXML();
trace(xml.getNamespaceForPrefix("exu")); // output: http://www.example.com/
util
trace(xml.getNamespaceForPrefix("")); // output: null
See also
getPrefixForNamespace (XMLNode.getPrefixForNamespace method)
(XMLNode.namespaceURI property)
1322
ActionScript classes
searches up the XML hierarchy from the
) as the
and there is a default namespace defined for
""
prefix
declaration for the given
xmlns
null
), the method returns that default
,
.
namespaceURI

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Flash 8

Table of Contents