|
|||||||
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
need help with loading XML data using javascript
Hi, i need to traverse this xml file (data.xml) for both FF and IE using javascript
Code:
<?xml version="1.0"?> <ArrayOfMenu> <menu name="רוקח ברישום"> <menu name="לרשום תרופה חדשה"> <item name="לשרת התשלומים של אגף הרוקחות" action="gotoURL" variables="http://ecom.gov.il/Counter/general/Homepage.aspx?counter=21"/> </menu> <menu name="לקבל אישור לאצווה ראשונה לתכשיר חדש"> <item name="טופס בקשה לאישור שיווק אצווה ראשונה של תכשיר רפואי" action="gotoURL" variables="http://www.psi.org.il/ToolBox/Docs/1st_batch.rtf"/> </menu> <menu name="לחדש רישום של תרופה"> <item name="טופס בקשה לתעודת איכות - המכון לביקורת ולתקינה" action="gotoURL" variables="http://www.psi.org.il/ToolBox/Docs/MachonCert.doc"/> <item name="נספח 1 - בטיחות TSE" action="gotoURL" variables="http://www.psi.org.il/ToolBox/Docs/TSE.doc"/> </menu> <menu name="לקבל אישור לשינוי בתכשיר רשום"> <item name="טופס בקשה לשינוי ברישום תכשיר רפואי מהיבט האיכות" action="gotoURL" variables="http://www.psi.org.il/ToolBox/Docs/Change_Machon.doc"/> </menu> <item name="google" action="gotoURL" variables="http://www.google.com"/> </menu> </ArrayOfMenu> so far i have this code, but i can't seem to manage to go beyond this point Code:
//Firefox only function - happens when a XML file is loaded
function loadHandler () {
xmlProcessor(this); //Call the Commen function with 'this' data.
}
//Load the xml file - using different method for different browsers
function xmlLoad(xml_file) {
//Initializations
feed_id = 0;
feed_total = 0;
var xmlDocument = "";
feed_file = xml_file;
if(document.implementation.createDocument) {//Firefox
xmlDocument = document.implementation.createDocument('', '', null);
xmlDocument.load(xml_file);
//This function will happen when the file is loaded
xmlDocument.addEventListener('load', loadHandler, false);
//xmlProcessor(xmlDocument); // i need help with this function to recurse through the tree structure
}
else { //IE
var xmlDocument = new ActiveXObject('Microsoft.XMLDOM');
xmlDocument.async = false;
var loadResult = xmlDocument.load(xml_file);
if (loadResult) {
// process xml document with DOM methods e.g.
// xmlProcessor(xmlDocument)
} else {
xmlError();
return false;
}
}
return true;
}
function xmlError() {
alert("Some error has occurred!")
}
//Process the xml data
function xmlProcessor(xmlDoc) {
if(!xmlDoc) {
feedError();
}
xmlLoad("data.xml"); // Load the XML file.
thanks Buzi |
|
#2
|
||||
|
||||
|
What problems are you having? Are you getting errors?
__________________
I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section. ![]() Please use [Code]your code goes in here[/Code] tags when posting code. Before posting your question, did you look here? Got a question on Linux? Visit our Linux sister site. Modifications Required For VB6 Apps To Work On Vista ![]() Microsoft MVP 2005/2006/2007/2008/2009 |
|
#3
|
|||
|
|||
|
hi
i decided to use a different method
thanks anyway |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| dynamic XML data island | Vincent | Web | 1 | 02-05-2003 10:03 AM |
| Loading of High Volume XML Data Island | Basavaraj Patil | Web | 0 | 01-12-2002 06:54 AM |
| Displaying XML Data using .Net Controls | Greg Rothlander | ASP.NET | 1 | 11-27-2001 07:09 PM |
| How does XML manage update of a data record? | RudySteury | XML | 4 | 03-14-2001 12:28 PM |
| XML Security | HSIN NING | Web | 0 | 08-21-2000 01:21 AM |