Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XML
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
XML General XML discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XML section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #11 (permalink)  
Old June 19th, 2007, 11:02 AM
Registered User
 
Join Date: Jun 2007
Location: Worthington, MN, USA.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:The only way is to use a server-side proxy that relays the requests from your server to the real server. Cross domain access is only forbidden on the client, servers have free reign.
Forgive me, for I'm newer to programming, and have much to learn.

So, if for example, my code was this:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>CBS Radio Network NewsFeed</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<script type="text/javascript">
var xmlDoc;
function loadXML()
{
// code for IE
if (window.ActiveXObject)
  {
  xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
  xmlDoc.async=false;
  xmlDoc.load("http://cbsradionewsfeed.com/rss.php?id=32&ud=146");
  getmessage();
  }
// code for Mozilla, Firefox, Opera, etc.
else if (document.implementation &&
document.implementation.createDocument)
  {
  xmlDoc=document.implementation.createDocument("","",null);
  xmlDoc.load("http://cbsradionewsfeed.com/rss.php?id=32&ud=146");
  xmlDoc.onload=getmessage;
  }
else
  {
  alert('Your browser cannot handle this script');
  }
}

function getmessage()
{
document.getElementById("title").innerHTML=
xmlDoc.getElementsByTagName("title")[0].childNodes[0].nodeValue;
document.getElementById("description").innerHTML=
xmlDoc.getElementsByTagName("description")[0].childNodes[0].nodeValue;
}
</script>
</head>

<body onload="loadXML()">
    <div id="CBSFeed">
        <h1><span id="title"></span></h1>
        <p><span id="description"></span></p>
    </div>
</body>
</html>
How would I go about doing this crazy magic you call server-side proxy? =)


Benny_A
----------
Are you not entertAIn3d?
Reply With Quote
  #12 (permalink)  
Old June 19th, 2007, 11:16 AM
joefawcett's Avatar
Wrox Author
Points: 9,731, Level: 42
Points: 9,731, Level: 42 Points: 9,731, Level: 42 Points: 9,731, Level: 42
Activity: 11%
Activity: 11% Activity: 11% Activity: 11%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,068
Thanks: 1
Thanked 38 Times in 37 Posts
Default

You'll have to scour Google for examples. Basically you have a web service running on your server that accepts as a parameter the desired URL, 'http://cbsradionewsfeed.com/rss.php?id=32&ud=146', for example. It then loads the content from this URL and passes it back to the original client. As the content is coming from the same domain as the client all is well. I believe Grease Monkey have a server-side proxy that can be used by others, try their site for ideas.

--

Joe (Microsoft MVP - XML)
Reply With Quote
  #13 (permalink)  
Old May 12th, 2010, 07:01 AM
Registered User
 
Join Date: May 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Smile

Code mentioned by Kalpakavalli.S works fine
Code:
 var fsoXML = new ActiveXObject("Scripting.FileSystemObject");
	var XMlFile = fsoXML.OpenTextFile("C:\\File1.xml",1);
	var Data = XMlFile.ReadAll();
	XMlFile.Close();

      
         loadXML(Data);
A bracket was left opened in OpenTextFile function..That was why Objecr Expected alert comes
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Access denied, can't create xml file from ASP.NET goldablasha C# 3 February 27th, 2007 04:50 AM
How to load an xml file that is in same project? tryston02 C# 2005 1 November 28th, 2006 01:50 PM
Getting VB.NET to load & update XML file kyma XML 0 March 19th, 2005 03:58 PM
access denied when uploading file daliaca BOOK: ASP.NET Website Programming Problem-Design-Solution 1 January 16th, 2005 10:08 AM
LOAD A XML FILE FROM JAVASCRIPT nen Javascript How-To 1 December 20th, 2004 10:03 AM



All times are GMT -4. The time now is 03:42 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.