This is an xml code for the fetching the article content of a science direct content. I want to know how would i extend this code and try finding fetching the words in the article with space, ie it should take a single word separated by a space. and from this i want to strip off the words which are common and index only those words which are unique.
<Module>
<ModulePrefs title="GetArticleContentGadget" author_email="">
<Require feature="sciverse"/>
<Require feature="dynamic-height"/>
</ModulePrefs>
<Content type="html" view="canvas,profile">
Profile view
<script type="text/javascript">
// Get userprefs
var prefs = new gadgets.Prefs();
function getHtml() {
var params = {};
var requestHeaders = {};
requestHeaders['X-ELS-APIKey'] = "72f54b470474297f4b552839c3b57522";
requestHeaders['X-ELS-ResourceVersion'] = "XOCS";
requestHeaders['Accept'] = "text/xml";
params[gadgets.io.RequestParameters.CONTENT_TYPE] = gadgets.io.ContentType.TEXT;
params[gadgets.io.RequestParameters.HEADERS] = requestHeaders;
var url = "http://api.elsevier.com/content/article/DOI:10.1016/0092-8674(93)90500-P?view=FULL";
gadgets.io.makeRequest(url, response, params);
};
function response(obj) {
//obj.text contains the text of the page that was requested
var str = obj.text;
var html = str;
document.getElementById('content_div').innerHTML = html;
};
gadgets.util.registerOnLoadHandler(getHtml);
/*
* This function calls the container to get the current article content.
*/
function getContent()
{
gadgets.sciverse.getArticleContent(getContentCallback);
}
/*
* Call back function to process content
*
* response - response from getArticleContent call, string of article page body
*
*/
function getContentCallback(response)
{
document.getElementById("articleHTML").innerHTML = "test";
if (response != null)
{
document.getElementById("articleHTML").innerHTML=response;
WebRequest req = HttpWebRequest.Create("");
WebResponse webResponse = req.GetResponse();
}
// Tells gadget to resize itself
gadgets.window.adjustHeight();
}
</script>
]]></Content>
i dont know why am not able to show the code properly?
Code lines need to be indented with 4 or more spaces. However, there are still issues with your code after editing; I don't know why.
I don't understand what you want to do exactly? You want to parse the content and index unique words in javascript?
yes . I need to parse the content of the article and index the unique words.