Accessing Comments and Processing Instructions : Comments and Processing Instructions « XML « Flash / Flex / ActionScript






Accessing Comments and Processing Instructions

 

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

        var novel:XML = <BOOK ISBN="0000000000">
            <!--Hello world-->
            <?application someData?>
            <TITLE>ActionScript</TITLE>
            <AUTHOR>J, J</AUTHOR>
            <?app2 someData?>
            <PUBLISHER>Books Ltd</PUBLISHER>
            <!--The End-->
          </BOOK>
        
        novel.ignoreComments = false;
        novel.ignoreProcessingInstructions = false;
        
        trace(novel.comments(  )[0]);                // <!--Hello world-->
        trace(novel.comments(  )[1]);                // <!--Goodbye world-->
        trace(novel.processingInstructions(  )[0]);  // <?app1 someData?>
        trace(novel.processingInstructions(  )[1]);  // <?app2 someData?>

    }
  }
}

        








Related examples in the same category

1.To obtain an XMLList representing all comments and processing instructions within an entire XML tree
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