Easy A
Would you like to react to this message? Create an account in a few clicks or log in to continue.


 
HomeHome  Latest imagesLatest images  SearchSearch  RegisterRegister  Log inLog in  

Share
 

 parsing xml across domains

View previous topic View next topic Go down 
AuthorMessage
Tiger
Member
Member
Tiger

Posts : 7
Join date : 2011-04-17

parsing xml across domains Empty
PostSubject: parsing xml across domains   parsing xml across domains EmptyThu Jun 23, 2011 7:57 am

I'm trying to work with XML DOM for the first time as I need to grab a value from a SOAP request. I've been following this: http://www.w3schools.com/xml/xml_parser.asp, which says modern browsers won't parse xml files from another server for security reasons. How would I got about doing this then? I've been using the price of crude oil as an example (http://www.google.com/ig/api?stock=OIL) and want code portable enough to put on something like Tumblr, so I don't think I can actually save the file locally first. Any ideas?

Thanks,
Back to top Go down
Stronger
Member
Member
avatar

Posts : 17
Join date : 2011-03-09

parsing xml across domains Empty
PostSubject: Re: parsing xml across domains   parsing xml across domains EmptyThu Jun 23, 2011 7:57 am

a few options (fire up google) :

1. yql for raw prices api or xml>jsonp conversion
2. cors (access-control headers)
3. flash xss via crossdomain.xml
4. rss data sources to js via yahoo pipes
5. greasemonkey to execute code on the data's domain
6. server-side ajax proxy
Back to top Go down
Tiger
Member
Member
Tiger

Posts : 7
Join date : 2011-04-17

parsing xml across domains Empty
PostSubject: Re: parsing xml across domains   parsing xml across domains EmptyThu Jun 23, 2011 7:58 am

Well I did some research and it looks like Google can spit out json itself:
http://www.google.com/finance/info?client=ig&q=OIL.

I've never worked with json before. What's the best way to load it as an object from a url?

Also, is there really no Google version of yql? Honestly, I get a little afraid of Yahoo stuff dropping off the face of the earth. I may just have to end up using Google for all my data sources here, which is a little disappointing. I was planning on using the National Weather Service's SOAP service.
Back to top Go down
Stronger
Member
Member
avatar

Posts : 17
Join date : 2011-03-09

parsing xml across domains Empty
PostSubject: Re: parsing xml across domains   parsing xml across domains EmptyThu Jun 23, 2011 8:00 am

Tiger wrote:
Well I did some research and it looks like Google can spit out json itself:
http://www.google.com/finance/info?client=ig&q=OIL.

I've never worked with json before. What's the best way to load it as an object from a url?


research jsonp:
Code:

<script src="http://www.google.com/finance/info?client=ig&q=OIL&callback=alert"></script> 

afaik, yahoo is the only major site that's benevolent enough to proxy anyone's xml data into json for free.

if they do die, you can create your own soap to json tool using php, xslt, or asp. they are even some almost drop-in tools to do basic conversions.

another option is to use a simply proxy to grab the code from NWS and serve it as an untouched string, feeding it to client side ajax that the handles xml.

server-wise that's a one or two line script that should be able to be served for free without ads (as javascript) from one of the dozens of free hosting services that offer any type of server scripting.

this also lets you scrape HTML using the browser DOM tools, which are FAR superior to any backend HTML parser. If you simply proxy a few urls in whole, your ajax can grab html table, csv, and xml data from nws. you can sniff img tags to grab the src url, embeding that image without cruft into your own site. lots of options...
__________________
Back to top Go down
Sponsored content




parsing xml across domains Empty
PostSubject: Re: parsing xml across domains   parsing xml across domains Empty

Back to top Go down
 

parsing xml across domains

View previous topic View next topic Back to top 
Page 1 of 1

 Similar topics

-
» Ruby CSV Parsing
» Please help - Dom Parsing XML file to HTML?

Permissions in this forum:You cannot reply to topics in this forum
Easy A :: parsing xml across domains Edit-trash Useless :: Trash-