[thelist] XML and Javascript: 2 questions

Peter-Paul Koch pp.koch at gmail.com
Fri Oct 1 04:53:53 CDT 2004

> Question 1:
> Can someone tell me if javascript can be used to load and parse an XML
> document if the javascript is on one web site (xyz.domain.com) and the
> XML is on another (abc.domain.com)?

JavaScript cannot access files that come from another server, so the
answer is No.

You could, of course, use a server side script to fetch the XML and
then serve it from your server. Then the scripts would work.

> Question 2:
> I have IE6 and have loaded and parsed with javascript an XML document
> that is valid RDF format (with doctype and defined entities etc). But
> when trying to test editing this document in XML Notepad, which has a
> feature to validate XML to IE5, XML Notepad can't open it. Which leads
> me to suspect that IE versions < 6 will choke when my javascript tries
> to read this file. Am I correct?

I don't know, but I've never seen IE Win (any version) crash on an XML
file. Why don't you try it and see what happens? Install multiple IE
versions on one Windows machine
(http://www.quirksmode.org/browsers/multipleie.html) and test it.

ppk, freelance web developer
Interactie, copywriting, JavaScript, integratie

More information about the thelist mailing list