You want to remove whitespace
nodes from your
XML object because they are interfering with
your ability to programmatically extract the values you want.
true before loading
external data into an
XML object or before
parsing any string into an
XML object, or use a
removeWhitespace( ) method to remove
whitespace nodes after loading data or for legacy purposes.
XML documents are often written with extra whitespace characters for the purposes of formatting so that it is easier for humans to read. Most of the time, each element appears on its own line (meaning that newline, carriage return, or form feed characters have been added), and child nodes are sometimes indented using tabs or spaces. In what follows, you can see the same XML data formatted in two ways. The first is the data formatted without the whitespace characters, and the second is the same data with formatting. Which is easier to read?
<book><title>ActionScript Cookbook</title><authors><author name="Joey Lott" /></authors></book>
<book> <title>ActionScript Cookbook</title> <authors> <author name="Joey Lott" /> </authors> </book>
While the formatted XML data may be easier for you, as a human, to read, the unformatted XML data is better suited for Flash. Flash counts all of the whitespaces as their own text nodes, which means that Flash parses every newline or tab character into its own node. The result is that ...