Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Xml Dom not parsing

 
Lila Fowler
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Paul Clapham
Sheriff
Posts: 21140
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, that explained why it wasn't working.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic