faqts : Computers : Programming : Languages : JavaScript : XML : E4X (ECMAScript for XML) : XML 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 children()?
How do I use the method children()?

Apr 9th, 2005 03:51
Martin Honnen,


The method children takes no argument and returns an XMLList with the
child nodes of this XML object. You can also use the wild card property
access '*' to have the same result:
  XML.ignoreComments = false;
  var gods = <gods>
    <!-- Kibology for all. -->
    <god>Kibo</god>
    <!-- All for Kibology. -->
    <god>Xibo</god>
  </gods>;
  var childNodes = gods.children();
  alert(childNodes.length()); // shows 4
  var childNodes2 = gods.*;
  alert(childNodes2.length()); // shows 4