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!

Mozilla サポートの検索

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

このスレッドはアーカイブに保管されました。 必要であれば新たに質問してください。

Trouble getting XML to display

  • 2 件の返信
  • 2 人がこの問題に困っています
  • 1 回表示
  • 最後の返信者: kunoichisama

more options

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)

more options

選ばれた解決策

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

more options

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.