faqts : Computers : Programming : Languages : JavaScript : XML : E4X (ECMAScript for XML) : XMLList objects

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

Entry

How do I use the method hasComplexContent?
How do I use the method hasComplexContent?

Apr 15th, 2005 05:46
Martin Honnen,


The method hasComplexContent takes no argument and returns true if the
XMLList contains exactly one XML element object which has complex
content or if the XMLList contains several XML element objects.
Otherwise the method returns false.
Here are some examples:
  var godList = <>
    <god>
      <name>Kibo</name>
    </god>
  </>;
  // one child with complex content
  alert(godList.hasComplexContent()); // shows 'true'
  godList = <>
    <god>Kibo</god>
  </>;
  // one child with simple content
  alert(godList.hasComplexContent()); // shows 'false'
  godList = <>
    <god>Kibo</god>
    <god>Xibo</god>
  </>;
  // several element childs
  alert(godList.hasComplexContent()); // shows 'true'