Is there a workaround?
]]>I tested your code and it works fine except that Firebug seems to bring up the following error message regarding your “src” attribute value…
not well-formed
Line 34
scriptEl.src = ‘http://query.yahooapis.com/v1/public/yql?q=’ + encodedQuery + ‘&format=json&callback=YQLQuery.’ + uid;
…not sure what you make of that, I couldn’t see anything wrong with it myself.
(there is no such error with IE so I don’t know if it’s a bug in the code or with the Firebug console itself).
Any feedback appreciated.
Thanks James.
]]>http://docs.jquery.com/Ajax/jQuery.getScript
Cheers!
]]>http://www.maverick.it/m2stream/yql.php
I found YQL has these problems with HTML:
* content disappear in some cases (more below)
* ‘class’ attributes removed
* change tags order
* change some tags (‘b’ became ‘strong’)
* ambiguity between tags and attributes (think for example at style or title…)
The biggest problem I noticed is that some content may disappear.
If I try to get this HTML:
This <b>is</b> just a <strong>test</strong> |
The ‘content’ of the p object contains only “just a” and not “This”.
Anyway, my function has a little bug. Now is correct:
http://snipplr.com/view/13389/yql2dom-jquery-plugin/
Thanks for the suggestions. I didn’t know Yahoo Pipes has JSON output. I’ll give it a shot. ; )
]]>ul#latest-news you could try:
select * from html where url='http://news.com' and xpath='//[@id="latest-news"]/li' |
Another cool thing you can do is only select certain properties/nodes, so instead of selecting all (*) you can select all content:
select content from... |
Or, for example, all HREF attributes from all anchors:
select href from... xpath='//a' |
The order of the children tags returned has been correct for me so far – what lead you to that conclusion?
It may make more sense for you to use Yahoo Pipes. It requires you to make a pipe yourself but once you’ve created it you can retrieve all the HTML within any page as a string. Have a look: http://pipes.yahoo.com/pipes/pipe.edit (drag in the “fetch page” source, link it up with the output box, then save it and retrieve as JSON)
]]>If that’s ok for someone, here’s my function that try to convert YQL JSON to HTML: http://snipplr.com/view/13389/yql2dom-jquery-plugin/
]]>Thanks for the useful example of using the power of JSONP and YQL to bring a remote RSS feed into the client!
]]>