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?

4 of 4 people (100%) answered Yes
Recently 4 of 4 people (100%) answered Yes

Entry

How do I use the method toXMLString?
How do I use the method toXMLString?

Apr 12th, 2005 04:46
Martin Honnen,


The method toXMLString takes no argument and returns a string with the
serialized XML markup for this XML object.
Depending on the global settings for XML.prettyPrinting and
XML.prettyIndent the markup might be pretty printed i.e. formatted and
indented to allow for easier reading by a human.
Here are some examples:
  var gods = <gods><god>Kibo</god><god>Xibo</god></gods>;
  alert(gods.toXMLString());
  /* shows
  '<gods>
     <god>Kibo</god>
     <god>Xibo</god>
   </gods>'
   as by default prettyPrinting with indent of two is done.
  */
  XML.prettyPrinting = false;
  alert(gods.toXMLString());
  /* shows
  '<gods><god>Kibo</god><god>Xibo</god></gods>'
  */