spacer
Yehuda Shiran January 30, 2002
Waiting for XML Loading
Tips: January 2002

Yehuda Shiran, Ph.D.
Doc JavaScript

Developer News
Eclipse Helios Update Brings New PHP Tools
Internet Explorer 9 Ups Standards Support
JBoss Portal 5 Release Easier to Use

There are two ways to list the content of the DOMDocument object. Our first display shows only the data-related elements of the object. You accomplish this by asking for the xml property of the root element, xmldoc.documentElement. The load1() function demonstrates this presentation:

function load1() {
  var xmldoc;
  xmldoc = new ActiveXObject("Msxml2.DOMDocument.3.0");
  xmldoc.async = false;
  xmldoc.load("mydvd.xml");
  alert(xmldoc.documentElement.xml);
}
Try it now. You should get the mydvd store file, with just the data elements.

Our second display includes all items in the XML file, including the directives in the beginning of the file, such as the XML version or the XSL file name. You accomplish this by asking for the xml property of the DOMDocument object. The load2() function demonstrates this presentation:

function load2() {
  var xmldoc;
  xmldoc = new ActiveXObject("Msxml2.DOMDocument.3.0");
  xmldoc.async = false;
  xmldoc.load("mydvd.xml");
  alert(xmldoc.xml);
}
Try it now. You should get the mydvd store file, with all initial settings and directives.


People who read this tip also read these tips:

Look for similar tips by subject:

webref The latest from WebReference.com Browse >
Flashmaps' DynamicLocator: Interactive Maps for Small Areas · Flashmaps' AreaSelector: Interactive Maps for Wide Areas · The DB Mapper: Interactive Street-level Maps of U.S. and Canada
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
MS Access and MySQL · Cisco AutoQoS: VoIP QoS for Mere Mortals · While VoIP Adoption Explodes in Enterprise, Carrier Spending Lags