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 length?
How do I use the method length?

Apr 16th, 2005 00:04
Martin Honnen,


The method length takes no argument and returns the number of XML
objects this XMLList contains.
Here are some examples:
  var godList = <>
    <god>Kibo</god>
    <god>Xibo</god>
  </>;
  alert(godList.length()); // shows 2
  for (var i = 0; i < godList.length(); i++) {
    alert(godList[i].toXMLString());
  }
  /* shows
  '<god>Kibo</god>'
  '<god>Xibo</god>'
  */