Hi Benjamin, > I had to do the same thing for a couple a sites and did something like:
Can you give a concrete example (URL) ? Thanks in advance. Benoit On 10 août, 16:49, "Benjamin Sterling" <[EMAIL PROTECTED]> wrote: > Benoit, > I had to do the same thing for a couple a sites and did something like: > var docXML = Arrya(); > loadXml = function(xmlFile, index, func){ > try{ > $.ajax({ > url : xmlFile, > dataType : 'xml', > async : false, > success : function(){docXML[index] = arguments[0];(typeof > func == "function") ? func(): '';}, > error : function(x, s, e){} > }); > } > catch(e){ > $.iLogger.log(e.name + ': ' + e.message, 'error', 'loadXml();'); > } > > } > > Once the docXML is set, I grabbed info from like (using your xml) > > $('prompt/IpAddress', docXML[theIndexYouused]).text(); > > On 8/10/07, Benoit <[EMAIL PROTECTED]> wrote: > > > > > > > > > Hello, > > > First of all, I'm new with Jquery. > > > I would like to use an xml file to translate a website. For the moment > > I use "pure javascript", but the problem is that it's fonctionnal with > > IE6&7, FF2 and Opera, but not with Safari (Mac). > > > So, I would like to use now Jquery to do the same thing because Jquery > > is compatible with Safari. > > > My actual code : > > > XML file : chineese.xml > > --------------------------------- > > > <prompt> > > <IpAddress>Ip 地址 :</IpAddress> > > <SubNetMask>子网隐码 :</SubNetMask> > > <English>English :</English> > > <French>French :</French> > > <German>German :</German> > > </prompt> > > > HTML file : > > --------------- > > > <html> > > <head><script language="javascript" src="translation.js"></script></ > > head> > > <body onload="loadXML()"> > > <span id="IpAddress"></span> 195.168.10.20 <br> > > <span id="SubNetMask"></span> 255.255.255.0 <br> > > </body> > > </html> > > > Translation.js : > > -------------------- > > > function loadXML() > > { > > if (window.ActiveXObject) > > { > > xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); > > xmlDoc.async=false; > > xmlDoc.load(chineese.xml); > > translateall(); > > } > > else if (document.implementation && > > document.implementation.createDocument) > > { > > xmlDoc = document.implementation.createDocument("","",null); > > xmlDoc.load(chineese.xml); > > xmlDoc.onload = translateall; > > } > > else > > { > > alert('Your browser cannot handle this script'); > > } > > } > > > function translateall() > > { > > var elem; > > var Prompts = new Array; > > var x = xmlDoc.documentElement; > > > for (i=0 ; i<x.childNodes.length ; i++) > > { > > Prompts[i] = x.childNodes[i].nodeName; > > } > > > for (i=0; i<Prompts.length; i++) > > { > > elem = document.getElementById(Prompts[i]); > > if (elem) > > document.getElementById(Prompts[i]).innerHTML = > > xmlDoc.getElementsByTagName(Prompts[i])[0].childNodes[0].nodeValue; > > } > > } > > > I couldn't find a way using jQuery to get the tagName of an element. > > Someone can help me ? > > > I can use the following code to find the contain of a node but it's > > not that I want to do because it's a "static method": > > > $(function() > > { > > > $.get("chineese.xml", function(xml) > > { > > var IpAddress = $("IpAddress", xml).text(); > > $("div#IpAddress").html(IpAddress); > > }); > > > }); > > > Thanks in advance > > > Benoit -www.survoldefrance.fr/index.php?lang=UK > > -- > Benjamin Sterlinghttp://www.KenzoMedia.comhttp://www.KenzoHosting.com- > Masquer le texte des messages précédents - > > - Afficher le texte des messages précédents -