Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

is it possible to use xml to call/import html file

Status
Not open for further replies.

robert89

Technical User
Nov 19, 2003
125
CA
I have just started to work on a project which requires the ability to call pages from an archived website into an existing website. I have been seeing references to xml and don't know much about it. Is XML a language to use for this type of project? Is there a source,book or website that cuts to the chase in setting up such a thing.

Help appreciated.
Thanks,
Bob
 
XML is a markup language, similar to HTML. You can't use it to "call pages". It's possible that you might store the information from the old site in XML format, then use a server- or client-side script to display it on your live page, but that might be more trouble than it's worth.

What exactly do you mean by "call[ing] pages from an archived website into an existing website"?

-- Chris Hunt
Webmaster & Tragedian
Extra Connections Ltd
 
It sounds like what you need is something like XMLHttpRequest. It doesn't HAVE to get back XML.

Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
Hi Chris,
The Archived website has been declared a historic record. A research would come along to a live website, click on a link to archived websites. Clicking on a list (or whatever) would call up the archived website. The research would then explore the archived website and the information contained in it. Ideally, this exploration would be done in some form where the researcher would always have indicators that they were in an archived website and be able to easily return to the original site. i.e. site that gave them access to the archived site.

Hope this clarifies a bit.

Thanks,
Bob



 
Why can't you simple use a frameset, or an iframe, to contain the archived site's content?


Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
Hi Tracy,
Yep, know all about framesets, but can't use frames, guidelines, regulations etc.

Bob
 
Well, if you can't put them in a frameset, can you modify your "archived" pages to have a prominent note saying something like "This is an archived page of the site which may be out of date - the current version is at xxx.com"? Then just stick them on the site anyhow.

The web at large won't draw any distinction between "archived" pages and current ones. If it can be reached from a URL it's a live page. I don't see much point in complicating matters with X(HT)ML transfers.

-- Chris Hunt
Webmaster & Tragedian
Extra Connections Ltd
 
Well Chris,
It's an endless debate. Do you do what you think is right or do you do what your client wants? Of course you have heard of "Archives" in the sense of government or company archive where it is more than a word.

Not only will the web page be out of date, it will not be in existence except as an archived site. This archived site will sit on the client's site. The client wants their header footer and a notice that the site is an "Archived" site to appear, while at the sametime perserving the Archived site.

Using a frame set would expediate matters, actually make the task at hand a whole lot easier, but alas, do to accessibility issues, can't be using framesets. Lots of stakeholders to please.

In the end, the project will probably be a bit of this and a bit of that, trading one thing off for another. In the meantime, I am exploring all possible solutions.

Thanks for your thoughts,
Bob
 
How about something like (in PHP)


Code:
<?
echo("<p>This is an archived page</p>\n");
echo("<hr />\n");
$archivePage = "[URL unfurl="true"]http://www.tek-tips.com/viewthread.cfm?qid=1089682&page=1";[/URL]
$content = "";
$page=fopen($archivePage,"r");
while(!feof($page)) {
 $content .= fread($page,4096);
}
fclose($page);
echo($content);
?>

The code above can be seen in action here

As you can see it almost works. It's not going to display images or styles properly unless you can get a <base> tag in there.
I would suggest doing some kind of regexp and look for </head> then write a <base> tag in before it. This may work better... but I can see instances when it will fail.

On the frames note.
I'm sure it is possible to make accessible frames you know.

Foamcow Heavy Industries - Web design and ranting
Target Marketing Communications - Advertising, Direct Marketing and Public Relations
I wonder what possesses people to make those animated gifs. Do you just get up in the morning and think, "You know what web design r
 
Hi Foamcow,
Thanks for the suggestion. This becomes another possiblity.

As for the frames, I suspect that I can do a work around with this i.e. a no frames page. We're at the investigative stage a the moment. The no frames use is a corporate policy and I have not read the fine print to find out if there are any if ands and buts.

Thanks again,
Bob
 
Even if they don't allow frames, you might be able to convince them to go with an i frame. Inline frames are ideal for this sort of thing. Not sure about the accessibility issues with iframes though.

Have you looked into XMLHttpRequest? You can use that to query the archive site, and then insert the content you get back into a div on your page. That should do exactly what you need.

Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
Hi Tracy,
Thanks for the tip. I have to investigate how the xmlhttprequest works, but it sound like a good possiblity. As for the iframes, I am not sure of there compatiblity with the various browsers - in addition to the accessiblity issues, but have used them and will be investigating further.

Thanks again,
Bob
 
Iframes should be OK for any modern browser. They're a standard (X)HTML element. The one big problem I can see with a framed solution is that search engines are likely to point directly to the page contained in the frame.

Anybody following a link from the SEs direct to one of your archived pages won't get the framing page or see that it's an old page. I think Foamcow's server-side approach (or something like it) has gotta be the way to go. It ought to be possible to write a general purpose script with a URL like


The bit of the URL after "archive.pl" will be available to the script in (I think) the PATH_INFO environment variable. The script would need to retrieve the page, put in the disclaimer, tweak any links and (maybe) add a <base> element.

-- Chris Hunt
Webmaster & Tragedian
Extra Connections Ltd
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top