Warning: Declaration of Bootstrap_Walker::start_lvl(&$output, $depth) should be compatible with Walker_Nav_Menu::start_lvl(&$output, $depth = 0, $args = NULL) in /home/itport/public_html/wp-content/themes/itport-v5.0/functions/bootstrap-walker.php on line 25

Warning: Declaration of Bootstrap_Walker::end_lvl(&$output, $depth) should be compatible with Walker_Nav_Menu::end_lvl(&$output, $depth = 0, $args = NULL) in /home/itport/public_html/wp-content/themes/itport-v5.0/functions/bootstrap-walker.php on line 42

Warning: Declaration of Bootstrap_Walker::start_el(&$output, $item, $depth, $args) should be compatible with Walker_Nav_Menu::start_el(&$output, $data_object, $depth = 0, $args = NULL, $current_object_id = 0) in /home/itport/public_html/wp-content/themes/itport-v5.0/functions/bootstrap-walker.php on line 57

Warning: Declaration of Bootstrap_Walker::end_el(&$output, $item, $depth, $args) should be compatible with Walker_Nav_Menu::end_el(&$output, $data_object, $depth = 0, $args = NULL) in /home/itport/public_html/wp-content/themes/itport-v5.0/functions/bootstrap-walker.php on line 108
آی تی پورت | نمایش فایل xml در صفحه HTML
Warning: Use of undefined constant url - assumed 'url' (this will throw an Error in a future version of PHP) in /home/itport/public_html/wp-content/themes/itport-v5.0/header.php on line 56

Warning: Use of undefined constant title - assumed 'title' (this will throw an Error in a future version of PHP) in /home/itport/public_html/wp-content/themes/itport-v5.0/header.php on line 57
تجارت الکترونیکطراحی وب

نمایش فایل xml در صفحه HTML

مجله اینترنتی آی تی پورت

سلام ، در این آموزش میخواهیم به روش نمایش اطلاعات xml در صفحه HTML بپردازیم.

برای اینکار از کد زیر استفاده نمایید:

<html>

<body>

<script type=”text/javascript”>

if (window.XMLHttpRequest)

{// code for IE7+, Firefox, Chrome, Opera, Safari

xmlhttp=new XMLHttpRequest();

}

else

{// code for IE6, IE5

xmlhttp=new ActiveXObject(“Microsoft.XMLHTTP”);

}

xmlhttp.open(“GET”,”cd_catalog.xml“,false);

xmlhttp.send();

xmlDoc=xmlhttp.responseXML;

document.write(“<table border=’1′>”);

var x=xmlDoc.getElementsByTagName(“CD”);

for (i=0;i<x.length;i++)

{

document.write(“<tr><td>”);

document.write(x[i].getElementsByTagName(“ARTIST”)[0].childNodes[0].nodeValue);

document.write(“</td><td>”);

document.write(x[i].getElementsByTagName(“TITLE”)[0].childNodes[0].nodeValue);

document.write(“</td></tr>”);

}

document.write(“</table>”);

</script>

</body>

</html>

متن علامت گذاری شده با رنگ قرمز آدرس فایل XML مورد نظر هست.

گفتگو ها