Question:
Programming: How to parse and display scrollable data?
Walker
2009-08-17 07:35:37 UTC
How do webpages parse html (or any other advanced stuff) and display it on the web-browser? Does it parse and print the html entirely into memory, and the web-brower decides which portion to display at a time? If so, doesn't this waste memory? Will it be more efficient to parse and display one visible line at a time?

This question also extends to scrollable widgets such as text-boxes, image viewers.

Also, if my target machine is tight on memory, do you know of any efficient method to do this?

I'm guessing this is a very common thing, since I am unable to find the answer from search engines
Four answers:
2009-08-17 07:46:15 UTC
the browser has to build the complete page in memory rather than a line at a time because often it is not easy to fugure out how much or what data will appear where unless you do this. Think about the
construct. You do not know how much space you need until you find the closing . Also what happens if there is another
embedded in the first one.
?
2009-08-17 14:57:04 UTC
Well, your question does not make much sense to me. It sounds like your problem is not with the browsers html parser, but with visiting to many web pages, with each being saved to your temp. web pagess folder, and without enough ram. i may, of course, be wrong..there are a few things that you could do. the most common thing is to replace your ram with a better set, or to load up on as much of it as you can. Also, having a fewwebsitess saved on you cache is good, but to many will take up lots of your computers space, so be careful. If your problem is a slow computer, follow these examples.



If the problem is with html, although you would think it would be more efficient, due to the setup of html, it must render the entire webpage, else it may come up as xhtml error if they put it hrough the w3c markup validator; ie. what if the endtag is on a different line than the openning tag?



In short, the entire webpage must be loaded just incase.



hope i helped!
2009-08-17 14:48:46 UTC
I think this is not possible in HTML since the rendering via CSS does not allow to predict which parts of the file are visible or not. Besides Javascript requires access to the Document Object Model which is a in-memory representation of the website.



But many text editors use this selective loading technique to be able to edit large files without loading the whole file into the memory.



You need to determine which lines are currently visible in your text-box and use seek methods to find the matching lines in your file. How to exactly achieve this depends on the language and API you are using.
Pea Pod
2009-08-17 14:40:13 UTC
It depends on what your using to code
puts a brake in HTML.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...