admin管理员组文章数量:1334954
I have some XML files which are currently used to load data into Adobe Flex applications. I am trying to make an HTML5 version of the application, and I need to load this same data into the html "app" so I can use and manipulate like I would in Flex. I have searched and can't find any information or examples on how to do this, or even if it can be done.
For example, if my application is a quiz, I have the questions, choices, and correct answers in an XML file. I would like the HTML file to load this data so it can display my quiz and I can use JS and jQuery to show one question at a time. I just don't know how to "get" the xml file. I suppose I could also convert the xml to json if need be, but it would be easier to use the xml as is.
I have some XML files which are currently used to load data into Adobe Flex applications. I am trying to make an HTML5 version of the application, and I need to load this same data into the html "app" so I can use and manipulate like I would in Flex. I have searched and can't find any information or examples on how to do this, or even if it can be done.
For example, if my application is a quiz, I have the questions, choices, and correct answers in an XML file. I would like the HTML file to load this data so it can display my quiz and I can use JS and jQuery to show one question at a time. I just don't know how to "get" the xml file. I suppose I could also convert the xml to json if need be, but it would be easier to use the xml as is.
Share Improve this question edited Nov 22, 2010 at 19:15 Steve asked Nov 22, 2010 at 19:10 SteveSteve 14.9k37 gold badges138 silver badges245 bronze badges1 Answer
Reset to default 4You can do that by using Ajax and a Javascript XML parser. The best way to do that is with a JS library, like jQuery.
Check out jQuery ajax to grab your XML: http://api.jquery./jQuery.ajax/
jParse is a pretty decent xml parser: http://jparse.kylerush/
Ajax is for accessing pages in the same domain. If you need to grab a file on a different domain you'll have to find a different solution.
本文标签: javascriptConsume data from XML file in an HTML5 applicationStack Overflow
版权声明:本文标题:javascript - Consume data from XML file in an HTML5 application? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742363929a2460904.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论