News:

This week IPhone 15 Pro winner is karn
You can be too a winner! Become the top poster of the week and win valuable prizes.  More details are You are not allowed to view links. Register or Login 

Main Menu

XML Parser in Mozilla Browsers

Started by ben2ong2, October 05, 2006, 05:20:04 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ben2ong2

Plain XML documents are displayed in a tree-like structure in Mozilla (just like IE).
Mozilla also supports parsing of XML data using JavaScript. The parsed data can be displayed as HTML.
To create an instance of the XML parser with JavaScript in Mozilla browsers, use the following code:
var xmlDoc=document.implementation.createDocument("ns","root",null)
The first parameter, ns, defines the namespace used for the XML document. The second parameter, root, is the XML root element in the XML file. The third parameter, null, is always null because it is not implemented yet.
The following code loads an existing XML document ("note.xml") into Mozillas' XML parser:
<script type="text/javascript">var xmlDoc=document.implementation.createDocument("","",null);xmlDoc.load("note.xml");.........</script>
The first line of the script above creates an instance of the XML parser. The second line tells the parser to load an XML document called "note.xml".

You are not allowed to view links. Register or Login
You are not allowed to view links. Register or Login