Where did you install Firefox from? Help Mozilla uncover 3rd party websites that offer problematic Firefox installation by taking part in our campaign. There will be swag, and you'll be featured in our blog if you manage to report at least 10 valid reports!

ძიება მხარდაჭერაში

ნუ გაებმებით თაღლითების მახეში მხარდაჭერის საიტზე. აქ არასდროს მოგთხოვენ სატელეფონო ნომერზე დარეკვას, შეტყობინების გამოგზავნას ან პირადი მონაცემების გაზიარებას. გთხოვთ, გვაცნობოთ რამე საეჭვოს შემჩნევისას „დარღვევაზე მოხსენების“ მეშვეობით.

Learn More

Trouble getting XML to display

  • 2 პასუხი
  • 2 მომხმარებელი წააწყდა მსგავს სიძნელეს
  • 1 ნახვა
  • ბოლოს გამოეხმაურა kunoichisama

I've built a site that pulls in XML data from a file to display in an area on the page. I know the code was working correctly because it has and will display properly in previous versions of FF and other browsers. When I first was building this, I had a lower version of FF and could see the XML display fine. I recall older FF asking me once if it was ok to load the data. Now, I don't have that option. Have I done something wrong, or is this a security settings issue?

Here's the html Ref code, if it helps:

<script type="text/javascript">var xmlDoc=null;if (window.ActiveXObject){// code for IExmlDoc=new ActiveXObject("Microsoft.XMLDOM");}else if (document.implementation.createDocument){// code for Mozilla, Firefox, Opera, etc.xmlDoc=document.implementation.createDocument("","",null);}else{alert('Your browser cannot handle this script');}if (xmlDoc!=null){xmlDoc.async=false;xmlDoc.load("articles.xml");document.write("<p id=xml_index_p>");var x=xmlDoc.getElementsByTagName("ARTICLE");for (i=0;i<x.length;i++){document.write("<h2 id=xml_h2>");document.write(x[i].getElementsByTagName("TITLE1")[0].childNodes[0].nodeValue);document.write("</h2>");document.write("<p id=xml_index_p>");document.write(x[i].getElementsByTagName("SUM1")[0].childNodes[0].nodeValue);document.write("</p>");}document.write("</p>");}</script>
I've built a site that pulls in XML data from a file to display in an area on the page. I know the code was working correctly because it has and will display properly in previous versions of FF and other browsers. When I first was building this, I had a lower version of FF and could see the XML display fine. I recall older FF asking me once if it was ok to load the data. Now, I don't have that option. Have I done something wrong, or is this a security settings issue? Here's the html Ref code, if it helps: <pre><nowiki><script type="text/javascript">var xmlDoc=null;if (window.ActiveXObject){// code for IExmlDoc=new ActiveXObject("Microsoft.XMLDOM");}else if (document.implementation.createDocument){// code for Mozilla, Firefox, Opera, etc.xmlDoc=document.implementation.createDocument("","",null);}else{alert('Your browser cannot handle this script');}if (xmlDoc!=null){xmlDoc.async=false;xmlDoc.load("articles.xml");document.write("<p id=xml_index_p>");var x=xmlDoc.getElementsByTagName("ARTICLE");for (i=0;i<x.length;i++){document.write("<h2 id=xml_h2>");document.write(x[i].getElementsByTagName("TITLE1")[0].childNodes[0].nodeValue);document.write("</h2>");document.write("<p id=xml_index_p>");document.write(x[i].getElementsByTagName("SUM1")[0].childNodes[0].nodeValue);document.write("</p>");}document.write("</p>");}</script></nowiki></pre>

ჩასწორების თარიღი: , ავტორი: cor-el

გადაწყვეტა შერჩეულია

Firefox's Error Console (Tools menu) is a rich source of feedback on script errors and security restrictions. After opening the console, it usually is full of CSS warnings. Click the Clear button, then reload your page and check for anything serious. Does that provide any useful feedback?

You also might consider using the XMLHttpRequest object rather than document.implementation.

See https://developer.mozilla.org/en/XmlHttpRequest

პასუხის ნახვა სრულად 👍 0

ყველა პასუხი (2)

შერჩეული გადაწყვეტა

Firefox's Error Console (Tools menu) is a rich source of feedback on script errors and security restrictions. After opening the console, it usually is full of CSS warnings. Click the Clear button, then reload your page and check for anything serious. Does that provide any useful feedback?

You also might consider using the XMLHttpRequest object rather than document.implementation.

See https://developer.mozilla.org/en/XmlHttpRequest

Thanks for the help. I've been fiddling with it since posting the question and I realize it was something really wrong with my script. Don't know how it got so screwed up (honestly light years away from where it should be), but just happy to see FF calling my file now.