如何在HTML中读取XML文件 [英] How do I read XML file in HTML

查看:108
本文介绍了如何在HTML中读取XML文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以..我在我的网页上有一个幻灯片,并且有一个旧的(flash)幻灯片显示的管理控制面板,您可以在其中添加图像,描述和幻灯片的链接。它都写入.xml文件调用slike.xml



这是Naslovna.master中的代码

So.. I have a slideshow on my webpage and there is an 'Admin control panel' for old (flash) slideshow where you can add images, descriptions and links to the slideshow.. It all writes to .xml file called "slike.xml"

This is the code in "Naslovna.master"

<div class="ism-slider" data-play_type="loop" id="my-slider">
     <ol>
      <li>
	   <a href='http://www.autronic.hr/cms/Katalog.aspx?sifraKategorija=586' target="_self">
        <img src="/cms/userfiles/autronic.hr/flash/slike/SlideShow/banner1.jpg">
	   </a>
      </li>
      <li>
       <a href="http://www.autronic.hr/cms/Detaljno.aspx?sifraProizvod=8610" target="_self">
        <img src="/cms/userfiles/autronic.hr/flash/slike/SlideShow/banner2.jpg">
	   </a>
      </li>
      <li>
       <a href="http://www.autronic.hr/cms/Katalog.aspx?sifraKategorija=106" target="_self">
        <img src="/cms/userfiles/autronic.hr/flash/slike/SlideShow/banner3.jpg">
	   </a>
      </li>
      <li>
       <a href="http://autronic.hr/cms/Katalog.aspx?sifraKategorija=208" target="_self">
        <img src="/cms/userfiles/autronic.hr/flash/slike/SlideShow/banner4.jpg">
	   </a>
      </li>
	  <li>
       <a href="http://www.autronic.hr/cms/Katalog.aspx?sifraKategorija=596" target="_self">
        <img src="/cms/userfiles/autronic.hr/flash/slike/SlideShow/banner5.jpg">
	   </a>
      </li>
     </ol>
    </div>



(我已经分配了链接和图片,但我需要用.xml数据替换它们)



以下是slike.xml文件的示例..


(I have already assigned the link and the image but i need to replace those with the .xml data)

Here is an example how "slike.xml" file looks like..

<root>
  <imageset id="Akcije">
    <image>
      <thumb>/cms/userfiles/autronic.hr/flash/slike/Intel 8.jpg</thumb>
      <src>/cms/userfiles/autronic.hr/flash/slike/Intel 8.jpg</src>
      <linkPath>http://www.autronic.hr/cms/Katalog.aspx?sifraKategorija=597</linkPath>
      <opis>Intel 8 gen</opis>
      <delay>3000</delay>
      <idle />
      <datumIsteka />
      <datumObjave>23.01.2018</datumObjave>
    </image>





我需要阅读< src>和< linkpath>把它放在我的HTML中..



提前致谢!



我有什么试过:



我试过在其他论坛上寻找教程,但我没找到任何东西。



I need to read the <src> and <linkpath> and put it in my HTML..

Thanks in advance!

What I have tried:

I've tried looking for tutorials on other forums but I didn't find anything.

推荐答案

检查此示例。在示例中,它们正在形成文本框,在您的情况下,您需要在列表中创建锚标记。



javascript - 将XML节点映射到HTML表单元素 - Stack Overflow [ ^ ]
Check this example.In the example they are forming text box and in your case you need to create anchor tags inside list.

javascript - Mapping XML nodes into HTML form elements - Stack Overflow[^]


这篇关于如何在HTML中读取XML文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆