Click here to Skip to main content
12,397,805 members (52,764 online)
Rate this:
 
Please Sign up or sign in to vote.
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.
Posted 18-Jun-12 20:20pm
Comments
   
"Read" or perhaps "parse"?
--SA
   
Did you notice this is not a question? Besides, why not just finding and answer in the Web? It would be way faster...
--SA
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

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 with DOMParser.

—SA
  Permalink  
v2
Comments
Velkumar Kannan 19-Jun-12 2:34am
   
I want to just load an XML file from server using javascript. ie. Using client side code I want to load and get the contents of a XML file.
   
For goodness sake, what is "just load"?.. :-)
--SA
Manas Bhardwaj 19-Jun-12 6:30am
   
correct +5!
Sergey Alexandrovich Kryukov 19-Jun-12 10:01am
   
Thank you, Manas.
--SA
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

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[^]
  Permalink  
Comments
Velkumar Kannan 19-Jun-12 2:35am
   
I want to just load an XML file from server using javascript. ie. Using client side code I want to load and get the contents of a XML file.
Sandeep Mewara 19-Jun-12 2:51am
   
And using XMLHttpRequest can get you exactly what you want.
Manas Bhardwaj 19-Jun-12 6:30am
   
Good links +5!
Sandeep Mewara 19-Jun-12 11:08am
   
Thanks.
Sergey Alexandrovich Kryukov 19-Jun-12 10:04am
   
The question is not clear, so it may or may not be about parsing. What is "load", "get contents"?
Anyway, the links provide good overview, my 5.
--SA
Sandeep Mewara 19-Jun-12 11:08am
   
Thanks SA.
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

  Permalink  
Comments
Manas Bhardwaj 19-Jun-12 6:30am
   
my 5!
Prasad_Kulkarni 19-Jun-12 8:34am
   
Thank you Manas!
Sergey Alexandrovich Kryukov 19-Jun-12 10:02am
   
Useful links, a 5.
--SA
Prasad_Kulkarni 19-Jun-12 23:58pm
   
:) Thank you SA!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160721.1 | Last Updated 19 Jun 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100