03.05.2013 Views

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

The source for the SWF file contains the following script (note the comments for the Output<br />

strings). The rootNode does not have a default namespace, so its namespaceURI value is an<br />

empty string. The simpleNode defines a default namespace, so its namespaceURI value is the<br />

default namespace. The innerNode does not define a default namespace, but uses the default<br />

namespace defined by simpleNode, so its namespaceURI value is the same as that of<br />

simpleNode.<br />

var xmlDoc:XML = new XML()<br />

xmlDoc.load("NoPrefix.xml");<br />

xmlDoc.ignoreWhite = true;<br />

xmlDoc.onLoad = function(success:Boolean)<br />

{<br />

var rootNode:XMLNode = xmlDoc.childNodes[0];<br />

trace("rootNode Node namespaceURI: " + rootNode.namespaceURI);<br />

// Output: [empty string]<br />

}<br />

var simpleNode:XMLNode = xmlDoc.childNodes[0].childNodes[0];<br />

trace("simpleNode Node namespaceURI: " + simpleNode.namespaceURI);<br />

// Output: ... http://www.w3.org/2001/12/soap-envelope<br />

var innerNode:XMLNode = xmlDoc.childNodes[0].childNodes[0].childNodes[0];<br />

trace("innerNode Node namespaceURI: " + innerNode.namespaceURI);<br />

// Output: ... http://www.w3.org/2001/12/soap-envelope<br />

See also<br />

getNamespaceForPrefix (XMLNode.getNamespaceForPrefix method),<br />

getPrefixForNamespace (XMLNode.getPrefixForNamespace method)<br />

nextSibling (XMLNode.nextSibling property)<br />

public nextSibling : XMLNode [read-only]<br />

An XMLNode value that references the next sibling in the parent node's child list. This<br />

property is null if the node does not have a next sibling node. This property cannot be used<br />

to manipulate child nodes; use the appendChild(), insertBefore(), <strong>and</strong> removeNode()<br />

methods to manipulate child nodes.<br />

Availability: <strong>ActionScript</strong> 1.0; Flash Player 5<br />

Example<br />

The following example is an excerpt from the example for the XML.firstChild property, <strong>and</strong><br />

shows how you can use the XML.nextSibling property to loop through an XML node's child<br />

nodes:<br />

XMLNode 1351

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!