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

Apr 14th, 2005 04:54
Martin Honnen,


The method comments takes no argument and calls the method comments
(http://www.faqts.com/knowledge_base/view.phtml/aid/35373/fid/1784) on
each XML object in this XMLList object to return an XMLList with all the
comment child nodes of XML objects in this XMLList in order.
Here are some examples:
  XML.ignoreComments = false;
  var xmlList = <>
    <god>
      <name>Kibo</name>
      <!-- Kibology for all. -->
    </god>
    <god>
      <name>Xibo</name>
      <!-- All for Kibology. -->
    </god>
  </>;
  alert(xmlList.comments().length()); // shows 2
  alert(xmlList.comments().toXMLString());
  /* shows
  '<!-- Kibology for all. -->
   <!-- All for Kibology. -->'
  */