• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Xml Dom not parsing

 
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 90
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks, that explained why it wasn't working.
 
Whatever. Here's a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic