Προς το περιεχόμενο

emfanisi XML se HTML


Rayman_FMC

Προτεινόμενες αναρτήσεις

Δημοσ.

hello, borite na mou pite tropous pou borw na emfanizw xml se html meso javascript?

 

vrika to ekseis scriptaki, alla den kserw pos na tou pw to onoma tou xml arxeiou mou.

 

-------------------------------------------

var xmlDoc=new ActiveXObject("Microsoft.XMLDOM");

function loadXML(xmlFile)

{xmlDoc.async="false";

xmlDoc.onreadystatechange=verify;

xmlDoc.load(xmlFile);}

 

function verify()

{if(xmlDoc.readyState!=4)

return false;}

 

function traverse(tree) {

if(tree.hasChildNodes())

{document.write('<ul><li>');

var nodes=tree.childNodes.length;

for(var i=0; i<tree.childNodes.length; i++)

traverse(tree.childNodes(i));

document.write('</li></ul>');}

else

document.write(tree.text);}

 

function initTraverse(file)

{loadXML(file);

var doc=xmlDoc.documentElement;

traverse(doc);}

---------------------------------------------

 

kserw mono oti emfanizei aftomata opoiodipote arxeio leget data.xml alla thelw na xrisimopieisw allo onoma giati den exw mono ena xml arxeio.

 

an kserete allo tropo, px me XSL an sas einai efkolo... <img src="http://www.insomnia.gr/ubbthreads/images/graemlins/wink.gif" alt="" />

 

thanx

Δημοσ.
Rayman_FMC

said:

hello, borite na mou pite tropous pou borw na emfanizw xml

var xmlDoc=new ActiveXObject("Microsoft.XMLDOM");

function loadXML(xmlFile)

{xmlDoc.async="false";

xmlDoc.onreadystatechange=verify;

xmlDoc.load(xmlFile);}

 

 

το variable xmlFile indicates the XML file's path

so Πριν ξεκινησει η ρουτινα που το φορτωνει (InitTraverse)

>
xmlFile = "RayMansXMLfile.xml"

 

Το αρχειο φροντισε να ειναι στο ιδιο folder με το html για να δουλεψει αυτο!

 

 

Δημοσ.

HMMM R WE CHEATING!!!!!!!!!!!

 

Ola ston Brian, tha sou deiksw egw tha deis ti tha patheis :P <img src="http://www.insomnia.gr/ubbthreads/images/graemlins/laugh.gif" alt="" /> <img src="http://www.insomnia.gr/ubbthreads/images/graemlins/laugh.gif" alt="" /> <img src="http://www.insomnia.gr/ubbthreads/images/graemlins/laugh.gif" alt="" />

 

Katebazeis pou katebazeis etoimo code, diabase kai ta comments!!!

 

Mesa sto html, ekei pou thes na baleis tin xml:

<script language=JavaScript>

inittraverse("imacheater.xml");

</script>

Δημοσ.

nai to vrika afto...tora psaxnw ta xlinks...vrika ta vrika kai afta diladi. Alla an thelw na ta emfanisw den borw na xrisimopieisw ton kodika afto pou evala panw. Thelei allo tropo, esu ti ekanes? XSL?

Δημοσ.

entaksi re paidia kai o kodikas pano..den einai tipota rocket science,...mia anadromh kanei sto DOM kai arxizei kai printarei ta tags! Plain and simple , to me XSL transformations mporeis na kaneis diafora..pragmati alla oxi oti kai afto den einai mia valid lysh!

Αρχειοθετημένο

Αυτό το θέμα έχει αρχειοθετηθεί και είναι κλειστό για περαιτέρω απαντήσεις.

  • Δημιουργία νέου...