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 comments()?
How do I use the method comments()?

Apr 9th, 2005 04:08
Martin Honnen,


The method comments takes no arguments and returns an XMLList with the
comment nodes which are children of this XML object:
  XML.ignoreComments = false;
  var gods = <gods>
    <!-- Kibology for all. -->
    <god>Kibo</god>
    <!-- All for Kibology. -->
    <god>Xibo</god>
  </gods>;
  var comments = gods.comments();
  alert(comments.length()); // shows 2
  alert(comments[0]); // shows '<!-- Kibology for all. -->'
  alert(comments[1]); // shows '<!-- All for Kibology. -->'