To obtain an XMLList representing all comments and processing instructions within an entire XML tree : Comments and Processing Instructions « XML « Flash / Flex / ActionScript






To obtain an XMLList representing all comments and processing instructions within an entire XML tree

 

package{
  import flash.display.Sprite;
  
  public class Main extends Sprite{
    public function Main(){

        var novel:XML = <BOOK ISBN="0000000000" INSTOCK="false">
            <TITLE>ActionScript</TITLE>
            <AUTHOR>J, J</AUTHOR>
            <PUBLISHER>Books Ltd</PUBLISHER>
          </BOOK>;
        
        var tempRoot:XML = <tempRoot/>;
        tempRoot.appendChild(novel);
        
        trace(tempRoot..*.comments(  )[0]);  // First comment in the document
    }
  }
}

        








Related examples in the same category

1.Accessing Comments and Processing Instructions
2.Search for elements only while ignoring text nodes, comments, and processing directives, use elements()
3.Finding Node Types: element, attribute, text, comment, processing-instruction
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