Click to See Complete Forum and Search --> : referencing content from an XML file


monfu
04-23-2003, 03:25 AM
Dear All,

I wish to link to an external XML file (which resides on a different server from ours) and then extract some content from it to display it on my web page. However, since I am new to XML and have never worked with this technology, I was wondering if anyone could help me out please. Can you tell me what I have to do to link to it, and maybe can you suggest some help tutorials on how I can achieve this?

Thanks for your help and time

khalidali63
04-23-2003, 10:10 AM
Here is one way of doing it,It uses XML Island which you can create only in IE5+ browsers.
Check out the link below.You will see that it points to an XML file residing on the server.Once its loaded then parsing the xml file is fairly simple utilising DOM methods.

http://68.145.35.86/skills/javascripts/xmlstuff/ParseXML.html

Now for the tutorials,internet is full of resources,you may want to start from

http://xml.org

:D

monfu
04-24-2003, 02:34 AM
Hi khalidali63,

I tried an XML island, but the problem was that locally, ie on my server, it was working, however when I uploaded it on the web, it did not work. May I tell you that the XML is not residing on my server, but on another server. Does it have to do with permission rights?

Thanks for your help

khalidali63
04-24-2003, 07:34 AM
If its on a web server from where you can access it(best checkwould be write th url in your browsers address bar and hit enter).If you can load that page in your browser that means the url is good,and if its a good url then there must not be a problem,If there is a problem this means there is something else thats wrong......

monfu
04-24-2003, 07:51 AM
Hi khalidali63,

I tired that in the beginning mate and the url works fine. I know i have something wrong in my code, but since I am new to XML, I cannot figure out why. This is my code, maybe it can help better:-

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Weather Feed Test</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<xml src="http://www.maltaweather.org/wx7.xml" id="service" async="false">
</xml>
<table border="1" datasrc="#service">
<tr>
<td>Forecast: <span datafld="forecast"></span></td>
<td>Temperature: <span datafld="temperature"></span></td>
<td>Wind: <span datafld="wind"></span></td>
</tr>
</table>

</body>
</html>

khalidali63
04-24-2003, 07:53 AM
Whats the error that you got?

EDIT:
BTW,
I am not sure how you are trying to get values from your service object..(is it something IE related utilities do?),becuase you will have to go through the xml document and get the values fro a specific element...

monfu
04-24-2003, 08:00 AM
Hi khalidali63,

The problem is that locally, ie on my server, it is working, however when I uploaded it on our server, it does not work.

Thanks for your help

khalidali63
04-24-2003, 02:03 PM
Interesting...I think I know what you are talking about.
if i run the file from my hard drive,it returns the results,but if I upload the same file to my web server then its seems like
<xml src="http://maltaweather.org/wx7.xml" id="wreport" async="true"></xml>
its not reading the url....hunmm..which browser u are using...is it possible for you to try this link with browser 5 or 5.5

not with 6 cus I used that one

http://68.145.35.86/temp/xml-tonfu1.html

here is the same code and everything but it points to a file on my server instead of www.malta....

http://68.145.35.86/temp/xml-tonfu2.html

Now the reason seems like out of domain link while on the web browser is not being read...since I am not a MS person..can you point me to the API for <xml> tag somewhere on MSN sites?

monfu
04-25-2003, 02:42 AM
Hi khalidali63,

Thanks for your reply. The browser thing is no solution mate, cause I do not know what my clients will have installed. Also, there are other web sites that are using this service and I manage to see the weather report from my browser.

I also did what you did and it worked, ie I installed the XML on my server, and it worked, so the problem is with the http://www thing, and I am sure of that.

--Now the reason seems like out of domain link while on the web browser is not being read...since I am not a MS person..can you point me to the API for <xml> tag somewhere on MSN sites?

I did not understand this mate. What do you mean?

khalidali63
04-25-2003, 08:29 AM
out of domain means web pages that are served fromanother web browser..
I wanted to read the API or the documents on <XML> tag since its only a MS specific tag,there has to be a work around that will pass some parameter to make it overlook this security hickup...

monfu
04-25-2003, 08:37 AM
Ah I see, well I cannot help you since I am not that expert in MS either.

But thanks just the same for your help mate