want to convert RSS to html using only javascript - javascript

Sir i have a problem with my page i want to change the RSS to html using javascript . for this i was use feed2js from google code but whole was written in php and javascript . In my problem i want to make integration with JSP not only php please suggest me

XML is not the easiest format to work with in JavaScript, much easier if you can get a JSON feed of something, but as its an RSS feed you probably haven't got that choice.
You can parse XML in jQuery using http://archive.plugins.jquery.com/project/jFeed

Related

Get the HTML source code of a web page on JavaScript

I'm building an application and I need to get the html code source of a web page in order to parse it (this web page is not on my server).
I'm coding in Javascript and I can't find a way to do it, I know there is a way to do it in Python (with requests library) and I want basicaly the same thing in Javascript.
Does someone know how to do this ?
Thanks
Try this
document.documentElement.outerHTML

convert html into jpg and send mail - PHP

I have an HTML which contains images and javascript charts. I want to convert that HTML into an image and send as an attachment through email.
Is it possible?
If yes, which library should I use for this task?
Yes it's possible, but for that you need to use phantomjs.
Here is a php library i used for phantomjs.
http://jonnnnyw.github.io/php-phantomjs/
Its pure php solution (using phantomjs browser) and is very easy to use. Just install this library through composer and that's it you should be good to go.
Note: This solution is valid if you want to take screenshot of your html page through its URL.
Hope it helps :-)

How to parse JSON/XML file into javascript?

I made a program in Java which takes an XML document, which user chooses, and present its content on screen (on JLabel using Gui). That works fine. Now, I need to create it as a web based. I want to parse a JSON file, instead of xml file, into JavaScipt. I tried to use JSP and JavaScipt in combination with HTML5 but I didn't really find the correct way to do it.
So I am wondering if there is a possible way to do it this way or if it is better to use servlets (send the data in server side).
Also, I am wondering if it is better to use the existing Java code I have, using Javabeans, instead of JavaScipt. And then combine servlets with JSP in order to print the result on screen. I know JavaScipt is quicker than Java in web applications but I think I can't see a way to make a connection between JavaScript and HTML5 to accomplish this parsing.

Consume data from XML file in an HTML5 application?

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.
You 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.com/jQuery.ajax/
jParse is a pretty decent xml parser: http://jparse.kylerush.net/
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.

Loading text file from web, and parsing it with a script?

My .html has some associated data in a .txt file that I need to load when the page is loaded. I then need a script to be able to parse that data and do stuff with it in the page. Is there a quick-n-dirty way to do this? I was thinking I could just have a hidden and then run through its innerHTML, but DIVs don't seem to support that.
Thanks in advance...new to web stuff!
EDIT: here's another catch: I want this to work, ideally, if the .html is loaded either from an actual website or from a local machine. To my knowledge, AJAX and XMLHttpRequest won't work in this situation(?)
Do you have flexibility in the format of the text file? If so I would store the data in the text file in JSON format and just include it in the HTML head of the page using script tags. Then you can use some JavaScript when the page is ready to parse the information stored in the text/JSON file and manipulate the HTML page as needed.
The nice thing about this approach is that it is simple and does not require server side code. You didn't mention whether or not the text file was dynamically generated but it doesn't matter with this approach.
You should use AJAX to load the text and a callback function to parse it according to your requirements and perform whatever actions are necessary. If you're using a framework like jQuery, look into the jQuery AJAX functions: http://docs.jquery.com/Ajax
If you're not using a framework and are instead coding straight JavaScript, look at using the XMLHttpRequest object: https://developer.mozilla.org/en/XmlHttpRequest
That should be done server side using a programming language like PHP or Perl or such. If you have to do it with JavaScript for some odd reason, the only way is to do AJAX call to the file and insert it into the DOM. There's plenty of tutorials for that.
And yes, innerHTML works on div elements, as well as with everything else.

Categories

Resources