Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #14584 > unrolled thread
| Started by | Gaurav vinayak <vinayakgaurav198@gmail.com> |
|---|---|
| First post | 2012-06-20 01:55 -0700 |
| Last post | 2012-07-11 21:03 +0100 |
| Articles | 7 — 5 participants |
Back to article view | Back to comp.lang.javascript
is it possible to parse html pages using javascript?? Gaurav vinayak <vinayakgaurav198@gmail.com> - 2012-06-20 01:55 -0700
Re: is it possible to parse html pages using javascript?? Martin Honnen <mahotrash@yahoo.de> - 2012-06-20 12:41 +0200
Re: is it possible to parse html pages using javascript?? Arno Welzel <usenet@arnowelzel.de> - 2012-06-27 17:25 +0200
Re: is it possible to parse html pages using javascript?? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2012-06-27 21:05 +0000
Re: is it possible to parse html pages using javascript?? Arno Welzel <usenet@arnowelzel.de> - 2012-07-09 19:56 +0200
Re: is it possible to parse html pages using javascript?? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2012-07-09 18:51 +0000
Re: is it possible to parse html pages using javascript?? Dr J R Stockton <reply1228@merlyn.demon.co.uk.not.invalid> - 2012-07-11 21:03 +0100
| From | Gaurav vinayak <vinayakgaurav198@gmail.com> |
|---|---|
| Date | 2012-06-20 01:55 -0700 |
| Subject | is it possible to parse html pages using javascript?? |
| Message-ID | <88af4dff-5cd2-4119-b5ab-2163ee57e864@vs10g2000pbc.googlegroups.com> |
is it possible to parse html pages using javascript??
[toc] | [next] | [standalone]
| From | Martin Honnen <mahotrash@yahoo.de> |
|---|---|
| Date | 2012-06-20 12:41 +0200 |
| Message-ID | <4fe1a8eb$0$9510$9b4e6d93@newsspool1.arcor-online.net> |
| In reply to | #14584 |
Gaurav vinayak wrote:
> is it possible to parse html pages using javascript??
Recent versions of Firefox/Mozilla support that e.g.
var html =
'<html><body><p>Paragraph 1.<p id=p2>Paragraph 2</body></html>';
var htmlDoc = new DOMParser().parseFromString(html, 'text/html');
alert(htmlDoc.getElementById('p2').textContent);
XMLHttpRequest in recent Firefox/Mozilla (as well as Chrome I think)
also support parsing text/html documents with XMLHttpRequest e.g.
var req = new XMLHttpRequest();
req.open('GET', 'foo.html');
req.responseType = 'document';
req.onload = function() {
alert(req.responseXML.body.innerHTML);
};
req.send();
--
Martin Honnen --- MVP Data Platform Development
http://msmvps.com/blogs/martin_honnen/
[toc] | [prev] | [next] | [standalone]
| From | Arno Welzel <usenet@arnowelzel.de> |
|---|---|
| Date | 2012-06-27 17:25 +0200 |
| Message-ID | <4FEB25F9.3050807@arnowelzel.de> |
| In reply to | #14584 |
Gaurav vinayak, 20.06.2012 10:55: > is it possible to parse html pages using javascript?? What do you mean with "parse"? Do you know the DOM? -- Arno Welzel http://arnowelzel.de http://de-rec-fahrrad.de
[toc] | [prev] | [next] | [standalone]
| From | "Evertjan." <exxjxw.hannivoort@inter.nl.net> |
|---|---|
| Date | 2012-06-27 21:05 +0000 |
| Message-ID | <XnsA07FEAD51E2A8eejj99@194.109.133.133> |
| In reply to | #14710 |
Arno Welzel wrote on 27 jun 2012 in comp.lang.javascript: > Gaurav vinayak, 20.06.2012 10:55: > >> is it possible to parse html pages using javascript?? > > What do you mean with "parse"? Do you know the DOM? You could parse a html-file as a textfile using either serverside or clientside javascript. -- Evertjan. The Netherlands. (Please change the x'es to dots in my emailaddress)
[toc] | [prev] | [next] | [standalone]
| From | Arno Welzel <usenet@arnowelzel.de> |
|---|---|
| Date | 2012-07-09 19:56 +0200 |
| Message-ID | <4FFB1B4A.3090300@arnowelzel.de> |
| In reply to | #14722 |
Evertjan., 27.06.2012 23:05: > Arno Welzel wrote on 27 jun 2012 in comp.lang.javascript: > >> Gaurav vinayak, 20.06.2012 10:55: >> >>> is it possible to parse html pages using javascript?? >> >> What do you mean with "parse"? Do you know the DOM? > > You could parse a html-file as a textfile > using either serverside or clientside javascript. Usually nobody uses JavaScript to "parse" HTML - you use the DOM, which means, the HTML is already parsed and accessible using methods like getElementById() etc.. -- Arno Welzel http://arnowelzel.de http://de-rec-fahrrad.de
[toc] | [prev] | [next] | [standalone]
| From | "Evertjan." <exxjxw.hannivoort@inter.nl.net> |
|---|---|
| Date | 2012-07-09 18:51 +0000 |
| Message-ID | <XnsA08BD41D541A9eejj99@194.109.133.133> |
| In reply to | #14971 |
Arno Welzel wrote on 09 jul 2012 in comp.lang.javascript: > Evertjan., 27.06.2012 23:05: > >> Arno Welzel wrote on 27 jun 2012 in comp.lang.javascript: >> >>> Gaurav vinayak, 20.06.2012 10:55: >>> >>>> is it possible to parse html pages using javascript?? >>> >>> What do you mean with "parse"? Do you know the DOM? >> >> You could parse a html-file as a textfile >> using either serverside or clientside javascript. > > Usually nobody uses JavaScript to "parse" HTML - you use the DOM, which > means, the HTML is already parsed and accessible using methods like > getElementById() etc.. While I doubt that you could determine what usually nobody does, as there would be nothing usual about things that nobody does, still it was the OQ of Gaurav, the OP, how to parse html pages using javascript. Inspecting the DOM would not quit qualify, would it, as inspecting the DOM could not be called parsing, could it? btw, Arno, If I wanted to parse an html-page downloaded to my server to extract relevant date with serverside javascript, as I and other of your nobodies a matter of fact sometimes do, there would be no DOM available, while as serverside javascript has some very nice and concise regex accessability methods not so easily accessable using other serverside scripting languages, like PHP or VBS. -- Evertjan. The Netherlands. (Please change the x'es to dots in my emailaddress)
[toc] | [prev] | [next] | [standalone]
| From | Dr J R Stockton <reply1228@merlyn.demon.co.uk.not.invalid> |
|---|---|
| Date | 2012-07-11 21:03 +0100 |
| Message-ID | <C9S$WmJOwd$PFwtc@invalid.uk.co.demon.merlyn.invalid> |
| In reply to | #14584 |
In comp.lang.javascript message <88af4dff-5cd2-4119-b5ab-2163ee57e864@vs 10g2000pbc.googlegroups.com>, Wed, 20 Jun 2012 01:55:39, Gaurav vinayak <vinayakgaurav198@gmail.com> posted: >is it possible to parse html pages using javascript?? Yes, if you present the HTML page as a string. Proof : One can write a Turing Machine in JavaScript. A Turing Machine can do anything computable. Parsing HTML pages is computable. QED. In practice, one can optimise that considerably. However, the task of properly parsing HTML by using JavaScript is probably beyond the ability of anyone who needs to ask your question. See <http://wsh2.uw.hu/index.html>, for instance, about JScript; and look up HTA pages. -- (c) John Stockton, nr London UK ?@merlyn.demon.co.uk IE8 FF8 Op11 Sf5 Cr15 news:comp.lang.javascript FAQ <http://www.jibbering.com/faq/index.html>. <http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources. <http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.javascript
csiph-web