say i have an rss feed, that i want to get data from- picassa specifically- which uses atom i suppose.
i want to be able to parse this rss file as xml file getElements/etc
im aware that reading it directly and manipulating probably wont work as it get some access cross domain error, so ive simply downloaded the file and hosted it on my own domain-(also is there any way to allow chrome to view xml data locally- it seems to think its cross server even when its viewed locally which makes preview editing a pain)
i cant seem to read the data properly through traditional means and searching appears to give severely outdated information
Go take a look at the YAHOO-PIPES service, it's free and easy to use. This will allow you to extract any information you need from an RSS feed and send the results to a server in JSON format if you require.
Related
Most of my experience with database manipulation has been through node.js, and writing simple APIs for class. I'm now trying a private project, where I would write a database, and read in information from it to display on a website hosted through github. however, for what I'm doing, an API seems unnecessary, as I should be able to upload the database file onto github, and have the website read from that, rather than hosting a node.js server. So, what I'm asking is at a high level, how would I get information from a database into a form I can read onto a website, and would just creating a json locally, or storing the info some other way, be a better solution?
If the database is very large, then this really should be done server side.
If the database is small, one option is to convert the sqlLite database to JSON, and then just use fetch to grab, and just parse using Javascript.
But another option I think you might like, is use a sqLite client compiled for the browser. If your browser is relatively new and supports webAssembly you might find this interesting.
https://github.com/sql-js/sql.js
Basically sqLite compiled for the browser..
One issue with any of these is security, anybody could of course download the JSON or Sqlite database in full and have full access. Server side you can implement user authentication etc.
I have shared folder between in my server which will allow other server to send XML file to me and I want my script read this file auto without opening any page.
I know how to open and read the file.
But the issue how to auto load in the backhand.
you have to create a one page which will read the provided file and do the required actions , then share this URL and format with the team who will going to provide you the xml file.
It is very much like API Endpoint, Where you have to write the code which will handled request and in this scenario your Endpoint will treat as a server and XML file provider will treat as clients.
I hope this answer helps u.
Thanks
Traditionally, you need your server to periodically execute the script which reads the XML. That PHP will need to parse the XML and handle the changes.
Alternatively, the source of the API can use push notification to avoid polling with your server. The XML will be received whenever a change occurred on the server without the creation of a lot of useless requests, but the XML will be parsed as in the previous approach.
Last, but not least, you can use WebSockets for this purpose, or if both computers are in the same network, you can use sockets. Off course, a lot depends on the data source, whether you have access there, how modern is its technology and what does it allow you to do.
On the client side I want to:
Generate random data up to a specified size (ex: 1Mb or 512Kb).
Write that data into a file.
Post that file to an endpoint on my server with an AJAX request.
I know #1 is possible, but I'm not sure how to do it. I'm not sure if #2 is possible; I've heard that Chrome currently supports the full HTML5 file API, but I need a solution that works on mobile browsers too (iOS Safari, Android, etc). #3 is easy and I already know how to do it (I included it for clarity about what I'm trying to do).
I agree with with sending data with post, but if you really want to create a file and then send it, you should read this question:
How to give a Blob uploaded as FormData a file name?
I'm trying to build a very simple bit of javascript that reads and displays a couple stock indexes when a webpage is loaded.
I was hoping to find an RSS feed with this data that I could then parse with jQuery.parseXML, but I couldn't track one down. What I did find is this: Yahoo Finance provides a way to download stock data in CSV format, specifying which data you're after via the URL.
So, I'm thinking this might be a way to accmplish what I'm after: when the page is loaded, I could send a request to Yahoo Finance, and then somehow parse the CSV data to get the data I need to populate my stock quote. My question relates to the aforementioned "somehow." Is there a way to do this via javascript? Is it possible to, for example, somehow load the CSV generated by Yahoo Finance as a string?
I'm also very open to any other suggestions of how to accomplish this. If anyone, for example, knows of an RSS feed from which I could get the S&P/TSX Composite index, please let me know!
You'll probably run into some cross site scripting problems as the browser will not let you do that. See the howto on that about avoiding that. You could also do it on the server side and then query that from you client. Depends on the server side technology you are using.
After that parsing the CSV shouldn't be a problem. Use something like string.split on each line.
JavaScript is by default not allowed to cross-domain requests unless you use JSON-P as your format, requesting CSV directly from another domain will not be allowed. Therefor this is a bit problematic. In this case you will probably have to setup a proxy within your own domain that will fetch the data from Yahoo server-side, and send it to your JavaScript from within your own domain.
I thought this was a quite common question, but for some reason I can't find the answer anywhere.
I want to read out xml data and put it in my html5 app. The xml file is hosted on a different server. So I've allready got an HTML5 site with layout, I've got the location of my xml file, how do I implement specific data in to my html?
In most browsers, you can't for security reasons. In some newer browsers you can use Cross-Origin Resource Sharing providing the data provider cooperates.
Otherwise you need to make the data available on the same server as the application, or have the data provided in JSON-P format.
For security reasons, you cannot use Javascript to read content from a different domain.
You need to write a server-side script on your domain to forward the XML.
You can then use normal AJAX to create the page.