MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE Reference page 1323

Actionscript 2.0 language reference
Table of Contents

Advertisement

getPrefixForNamespace
(XMLNode.getPrefixForNamespace method)
public getPrefixForNamespace(nsURI:String) : String
Returns the prefix that is associated with the specified namespace URI for the node. To
determine the prefix,
node, as necessary, and returns the prefix of the first
that matches
.
nsURI
If there is no
assignment for the given URI, the method returns
xmlns
assignment for the given URI but no prefix is associated with the assignment, the
xmlns
method returns an empty string (
Availability: ActionScript 1.0; Flash Player 8
Parameters
- The namespace URI for which the method returns the associated prefix.
nsURI:String
Returns
- The prefix associated with the specified namespace.
String
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
xmlDoc
getPrefixForNamespace()
www.example.com/util") returns the prefix
URI ("http://www.example.com/other") returns
represented by the
child1
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():XMLNode {
var str:String = "<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:XMLNode = createXML();
getPrefixForNamespace()
).
""
method. The
method with the defined namespace URI ("http://
variable, also defines a namespace URI ("http://
searches up the XML hierarchy from the
declaration with a namespace URI
xmlns
XML node, which is represented by the
Outer
exu
, but calling this method with an undefined
exu
. The first
null
. If there is an
null
prefix. Calling the
node, which is
exu:Child
XMLNode
1323

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Flash 8

Table of Contents