Finding Node Types: element, attribute, text, comment, processing-instruction : Comments and Processing Instructions « XML « Flash / Flex / ActionScript






Finding Node Types: element, attribute, text, comment, processing-instruction

 

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:

    }
  }
}

        








Related examples in the same category

1.Accessing Comments and Processing Instructions
2.To obtain an XMLList representing all comments and processing instructions within an entire XML tree
3.Search for elements only while ignoring text nodes, comments, and processing directives, use elements()
4.Converting Comments and Processing-Instructions to Strings
5.use the comments() method or the processingInstructions() method to get XMLLists
6.Setting Options for the XML Class