使用Javascript读取Xml文件. [英] Read a Xml file using Javascript.
本文介绍了使用Javascript读取Xml文件.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的aspx页面上,我必须读取一个XML文件,该文件位于客户端的服务器端.我必须阅读XML文件的内容.
谢谢,
Velkumar.
Hi,
I my aspx page I have to read an XML file, which is reside in server side from client side. I have to read the contents of the XML file.
Thanks,
Velkumar.
推荐答案
我不认为您的意思是读取",因为您可能知道如何读取任何文本文件.您可能需要解析.
请参阅以下问题: http://stackoverflow.com/questions/649614 /xml-parsing-of-a-variable-string-in-javascript [
I don''t think you mean "read", as you probably know how to read any text file. You probably need parsing.
Please see this question: http://stackoverflow.com/questions/649614/xml-parsing-of-a-variable-string-in-javascript[^].
First of all, you need to look for the answers withDOMParser
.
—SA
您想知道如何通过Javascript与服务器对话.
通过客户端(Javascript)与服务器端进行交互的方法很少:
1. XMLHttpRequest [回调 [ Web服务调用 [ PageMethod [ http://api.jquery.com/jQuery.ajax/ [ http://api.jquery.com/category/ajax/ [ http://www.w3schools.com/jquery/jquery_ref_ajax.asp [
You want to know how to talk to server from Javascript.
There are few ways to interact with server side through client side(Javascript):
1. XMLHttpRequest[^]
2. Callback[^]
3. WebService call[^]
4. PageMethod[^]
If you are not using ASP.NET then XMLHttpRequest or Callback is the way.
To use XMLHttpRequest or Callback, you can use jQuery. Here, have a look:
http://api.jquery.com/jQuery.ajax/[^]
http://api.jquery.com/category/ajax/[^]
http://www.w3schools.com/jquery/jquery_ref_ajax.asp[^]
请参阅:
XML和JavaScript [使用JavaScript解析XML文档 [
Please refer:
XML and JavaScript[^]
Parsing XML Documents in JavaScript [^]
这篇关于使用Javascript读取Xml文件.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文