Flash / Flex / ActionScript/XML/Node type

Материал из Web эксперт
Перейти к: навигация, поиск

Determining the Type of Content in a Node

   <source lang="java">

package{

 import flash.display.Sprite;
 
 public class Main extends Sprite{
   public function Main(){
       var contentTest:XML = <test>
                               <a />
                               Lorem Ipsum
                               <c>
                                  <d />
                               </c>
                             </test>;
       trace(contentTest.a.hasSimpleContent());  // Displays: true
       trace(contentTest.b.hasSimpleContent());  // Displays: true
       trace(contentTest.c.hasSimpleContent());  // Displays: false
       trace(contentTest.d.hasComplexContent()); // Displays: false
   }
 }

}

       </source>