• Post Reply Bookmark Topic Watch Topic
  • New Topic

Some querries  RSS feed

 
Nischal Topno
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can somebody help

1. What is worker thread.
2. What is the difference between DOM & SAX. When is one used over the other.

Nischal
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. Well, it's a thread in which you do work. Typically threads in a "thread pool" are called worker threads, the idea being that one thread assigns "work units" to the threads in the pool.

2. DOM builds a tree representation of a whole XML file in memory, and then you use the API to walk that tree. SAX is event-driven -- you get notified when the parser sees each element, attribute, etc. DOM uses more memory, but is generally easier and more intuitive to use, making it a good choice for small files and people new to XML. SAX is faster and uses far less memory, making it a good choice for large files.
 
Naina Si
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please have a look at the following link with a detailed explanation

http://www.developerlife.com/saxvsdom/default.htm

SAX throws events as the doc is being parsed. Only the current element is actually in memory, so there is no limit to the size of a doc when using SAX.

DOM parses the ENTIRE doc into memory, and then makes it available to you. The size of the doc you can parse is limited to the memory available.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!