XML Namespaces

This article isn't to teach you what namespaces are, how they work, and why you would use them, this article is just to help you take the first step to figuring out how to parse xml with namespaces in it.

var xml:XML = <root>
	<h:table xmlns:h="http://www.w3.org/TR/html4/">
	<f:table xmlns:f="http://www.w3schools.com/furniture">
	  <f:name>African Coffee Table</f:name>
trace("Not using a namespace");
trace(xml.table); // Nothing
var trNs:Namespace = new Namespace("http://www.w3.org/TR/html4/");
var furnitureNs:Namespace = new Namespace("http://www.w3schools.com/furniture");
trace("Using a namespace");
// You can also set the default xml namespace if you are repeatedly using the same namespace.
default xml namespace = new Namespace("http://www.w3.org/TR/html4/");
//trace("Using a namespace");