use the comments() method or the processingInstructions() method to get XMLLists : Comments and Processing Instructions « XML « Flash / Flex / ActionScript






use the comments() method or the processingInstructions() method to get XMLLists

 


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.*.comments().length()); // Displays: 2
        trace(example.body.comments().toXMLString());
        trace(example.body.comments()[1].toXMLString());
        trace(example.*.processingInstructions().toXMLString());


    }
  }
}

        








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.Finding Node Types: element, attribute, text, comment, processing-instruction
5.Converting Comments and Processing-Instructions to Strings
6.Setting Options for the XML Class