• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

interview question

 
sanjay dube
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All
These are a few interview questions on xml. I am a newbie to xml. I searched the site for the answers , got some brief answers but no detailed
explanation.
1) WHich is faster DOM or SAX. Kindly give an ellaborate answer. In practical applications which is more appropriate to use
2) What are namespaces used for. This is what i know in order to avoid name clashing between xml tags we can use namespaces .
Any other ??
3) Suppose if we want to manipulate some xml element values , Which 1 to for & why (dom or sax)
Rgrds
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1) WHich is faster DOM or SAX. Kindly give an ellaborate answer. In practical applications which is more appropriate to use
There is no one answer for this question, IMO.
Its as easy as asking "Is Java better or C better to write a program?"
2) What are namespaces used for. This is what i know in order to avoid name clashing between xml tags we can use namespaces .
Any other ??

That is correct. Namesapces are defined to differentiate between
same element-names used in different contexts.
3) Suppose if we want to manipulate some xml element values , Which 1 to for & why (dom or sax)
Same as above...its not easy.
Apples vs Oranges comparision.
Orange is orange in color, apple is not.
Oranges have more Vitamin C than apples.
anyways....you get the picture!
My two cents...
- madhav
 
Steve Agarwal
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
interview Q's
The person asked all the relevant Q's.
1) DOM is tree based memory intensive parser. and it can be updated
2) SAX is a event driven parser used for very large files. This doesnt allow any changes or update to the file( xml). This is read only.
DOM used SAX to handle its parsing. The best parser known in the market is dom4j which has a cleaner code for document handling.
DOM is only used for a very small data. SAX is used for a huge xml data file.
Steve
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic