Loading XML Data in Firefox

Home arrow AJAX Tutorials arrow Tutorial arrow Loading XML Data in Firefox
Loading XML Data in Firefox Print E-mail
Contributed by Teddy   
Wednesday, 20 September 2006

 What is Firefox?

Firefox is a free, open-source web browser for Windows, Linux and Mac OS X and is based on the Mozilla codebase. It is small, fast and easy to use, and offers many advantages over Internet Explorer, such as the ability to block pop-up windows.Firefox 1.5,have many features for XML developers,

 

Loading XML Data in Firefox

Firefox supports the load() method. Firefox implemented the async property, You can set async to false forces the document to be loaded in synchronous mode; otherwise, the document is loaded asynchronously.

oXmlDom.load("address.xml");

Retrieving XML Data in Firefox

Firefox  supports the W3C standards properties of attributes, childNodes, firstChild, lastChild, nextSibling, nodeName, nodeType, nodeValue, ownerDocument, parentNode, and previousSibling. So first  you need to retrieve the root element of the document by using the documentElement property,

var foxRoot = foxoXmlDom.documentElement;

 An example about how to return content of the node

function getText(foxNode) {
    var sText = "";
    for (var i = 0; i < foxNode.childNodes.length; i++) {
        if (foxNode.childNodes[i].hasChildNodes()) {
            sText += getText(foxNode.childNodes[i]);
        } else {
            sText += foxNode.childNodes[i].nodeValue;
        }
    }
    return sText;
}

Using XMLSerializer to  serialize XML

function serializeXml(foxNode) {
    var oSerializer = new XMLSerializer();
    return oSerializer.serializeToString(foxNode);
}

Last Updated ( Wednesday, 20 September 2006 )

  home              contact us

 

©2006-2008 DeveloperZone.biz   All rights reserved     powered by Mambo Designed by Siteground