Question:
How can i use JavaScript to read an XML file?
Amanda
2008-04-17 11:29:19 UTC
I am having difficulty using JavaScript to format an html file for a website that I'm building.

I've written a simple XML file, and would like to know how to use JavaScript to import the XML file and display the information on a table.

I've been unable to find examples, can anyone give me a website or an example of how to do this?
Three answers:
ajayx2001
2008-04-17 11:43:31 UTC
Well it's simple if you use Microsoft's MSXML parser and COM. I'll give out a simple example.



XML file is :







Mini Bus

This is a toy for children aged 4 and above

75

54





Barbie Doll

This is a toy for children in the age group of 5-10

20

20





Baby's Rattle

This is a toy for children in the age group of 0-2

5

25







XSL stylesheet :






















]>















Untitled Document









































JavaScript file:









Hope it helps.
barbre
2016-10-10 10:30:20 UTC
dll? As in, dynamic link library? Are you extremely, rather advantageous you're speaking approximately javascript? the factor is, i can't make any experience out of what you're asserting. DLL's are living house windows library information- they have been given nothin to do with javascript. XML makes kinda experience, yet you placed uh... the colour value to fillStyle = "automobile"? Like, "coloration = "fillStyle = "automobile"""? i can't make any experience out of that. So, please let us know what precisely you are trying to do, then we can help you.
anonymous
2008-04-17 12:12:53 UTC
The previous example will only work with Internet Explorer because it requires the use of an ActiveX component.



http://www.captain.at/howto-ajax-process-xml.php


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...