padolsey-archive / jquery.fn

A collection of jQuery plugins
http://james.padolsey.com
The Unlicense
1.1k stars 723 forks source link

Support for retrieving XML pages #9

Closed madoke closed 7 years ago

madoke commented 12 years ago

changes yql query according to jQuery.ajax() dataType parameter. If parameter is set to xml, it is possible to retrieve cross domain xml files like rss feeds.

sample:

$.ajax({ url: 'http://rss.news.yahoo.com/rss/topstories', type: 'GET', dataType: 'xml', success: function(res) { var xmldoc = $.parseXML(res.responseText); //Do other stuff here } });

DarkJeanie commented 12 years ago

Hi,

i tried out your changes to jquery.xdomainajax.js and tried to read an xml file, but somehow there is a problem with nested elements:

My xml file looks like this:

<?xml version="1.0" encoding="utf-8" ?>
<database>
    <table name="antwort">
      <column name="idantwort">2</column>
     </table>
</database>

but when i try to read the xml file, this is returned:

<database>
    <column name="idantwort">2</column>
    <table name="antwort"></table>
</database>

The example with the yahoo rss feed seems to work fine, although there are also nested elements. Have you got any idea how to fix this?

madoke commented 12 years ago

hi, I tried to reproduce the problem using your original XML but wasn't able to. Either the YQL console and the jquery.ajax modification return the correct file. Are you performing some kind of parsing/modification after you receive the message in the callback ? Also try to check if you are hosting a well-formed xml.

DarkJeanie commented 12 years ago

hi, sorry i didn't write it, but it solved the problem. I think the problem was the tag named "table". I changed that into something else and then it worked fine :)