• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 23. Introduction to XML > Moving Around Through XML

Moving Around Through XML

Remember that Flash uses a DOM-based system for working with XML. Under this system, after you have loaded and parsed some XML, you end up with a tree structure. The most common way to manipulate the XML is to walk through the XML tree to see what’s there and extract the relevant information.

Each “node” in an XML tree is actually an object. This is important! These objects can be either an XML element or text. For example, the structure listed here has five nodes. Three of those nodes are XML elements (<person>, <firstName>, and <lastName>). The remaining two nodes (John and Doe) are text nodes. When you’re stepping though a tree structure to extract information from the nodes, how are you going to know whether you’re in an XML element or a text node? Actually, it’s easy. The XML object has a property called nodeType. This read-only property can have a value of 1 or 3. A value of 1 tells you that you are inside an XML element (between the brackets). A value of 3 tells you that you’re inside a text node.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint