Top DevX Stories
Creating Custom Export Filters for StarOffice with XSLT
WPF Wonders: Using DataTemplates
Crystal Reports Family Offers Options for Developers
Avaya Aura Session Manager video
Avaya Aura Overview video
Search the forums:

Go Back   DevX.com Forums > DevX Developer Forums > XML

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old 10-02-2009, 08:17 AM
buzibuzi buzibuzi is offline
Registered User
 
Join Date: Oct 2009
Posts: 2
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
Reply With Quote
  #2  
Old 10-07-2009, 08:40 AM
Hack's Avatar
Hack Hack is offline
Super Moderator
 
Join Date: Apr 2007
Location: Sterling Heights, Michigan
Posts: 7,719
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
Reply With Quote
  #3  
Old 10-21-2009, 05:49 AM
buzibuzi buzibuzi is offline
Registered User
 
Join Date: Oct 2009
Posts: 2
hi

i decided to use a different method
thanks anyway
Reply With Quote
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

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


All times are GMT -4. The time now is 11:23 PM.


Sponsored Links



Acceptable Use Policy

internet.comMediabistrojusttechjobs.comGraphics.com

WebMediaBrands Corporate Info


Advertise | Newsletters | Feedback | Submit News

Legal Notices | Licensing | Permissions | Privacy Policy


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.