Vanwege onderhoudswerkzaamheden die uw ervaring zouden moeten verbeteren, heeft deze website beperkte functionaliteit. Als een artikel uw probleem niet verhelpt en u een vraag wilt stellen, kan onze ondersteuningsgemeenschap u helpen in @FirefoxSupport op Twitter en /r/firefox op Reddit.

Zoeken in Support

Vermijd ondersteuningsscams. We zullen u nooit vragen een telefoonnummer te bellen, er een sms naar te sturen of persoonlijke gegevens te delen. Meld verdachte activiteit met de optie ‘Misbruik melden’.

Meer info

Deze conversatie is gearchiveerd. Stel een nieuwe vraag als u hulp nodig hebt.

Trouble getting XML to display

  • 2 antwoorden
  • 2 hebben dit probleem
  • 1 weergave
  • Laatste antwoord van 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>

Bewerkt door cor-el op

Gekozen oplossing

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

Dit antwoord in context lezen 👍 0

Alle antwoorden (2)

more options

Gekozen oplossing

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.