Mega Code Archive

 
Categories / Flash ActionScript / XML
 

Finding Node Types

package{   import flash.display.Sprite;      public class Main extends Sprite{     public function Main(){         XML.ignoreComments = false;         XML.ignoreProcessingInstructions = false;         var example:XML = <html>                                   <head />                                   <body id="main">                                      Welcome!                                      <!-- Start PHP -->                                         <?php                                            // execute some php code                                         ?>                                      <!-- End PHP -->                                   </body>                                </html>;         trace(example.body.nodeKind()); // Displays: element         trace(example.body.@id.nodeKind()); // Displays: attribute         trace(example.body.text().nodeKind()); // Displays: text         trace(example.body.comments()[0].nodeKind()); // Displays: comment         trace(example.body.processingInstructions().nodeKind()); // Displays:     }   } }