File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes XML and Related Technologies and the fly likes Xml Dom not parsing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Xml Dom not parsing" Watch "Xml Dom not parsing" New topic

Xml Dom not parsing

Lila Fowler
Ranch Hand

Joined: Jul 31, 2009
Posts: 84
Hi All,

Im trying to get a simple example that takes data from .xml and prints titles onto the screen. I'v tried lots of different examples from different places but i cannot get any to work.
Here is the xml code:

Here is the java script &html

I have tried lots of different examples(this one is w3schools) but non of them pass my xml even though my html pg opens.
Using two different browsers(chrome & IE) both dont work.

Any ideas as to what i'm doing wrong?

Thanks a ton

*posted this in web services by mistake as well, sorry.

Courage is not the absence of fear but rather the judgment that something is more important then fear. ~ Ambrose Redmond
Paul Clapham

Joined: Oct 14, 2005
Posts: 19875

You are downloading a Javascript file from somewhere -- from the same directory as that HTML came from, anyway. And then you try to access something from the local file system. Normally Javascript can't access the local file system; but perhaps that Javascript loadXMLDoc function expects a URL to get the XML document from?

If that's the case, then you haven't given it an XML. A file path is not a URL. And even if you gave it a file:// URL, chances are that the browser would not allow the Javascript to connect to it, because that would be a cross-site scripting security violation.
Lila Fowler
Ranch Hand

Joined: Jul 31, 2009
Posts: 84
Thanks, that explained why it wasn't working.
I agree. Here's the link:
subject: Xml Dom not parsing
It's not a secret anymore!