what is an xml parser? how many types of parsers are there? which is the best xml parser to parse an xml document? how does an xml parser will work? can any one tell it briefly?
A XML Parser is a tool that converts XML into an accessible object (EDIT: Following the comments) or into a series of events. Basically anything you can use to consume and act on XML data
Can you specify a language for the other qustions?
For understanging Parsers you need to take off the XML bit and ask yourself what is a Parser?
An XML parser is, just like any other parser, a tool which converts from a transport representation (text, in this case) to something you can access from your code (in this case, a tree or a series of parsing events, depending on the parser type).
There are two major types of XML parsers nowadays: DOM parsers which create an in-memory object tree from the XML structure and serial parsers, such as SAX.
For a DOM parser the parser has to read the entire XML document and construct in-memory objects: Tree nodes, attribute nodes, etc. and put them into a suitable tree structure representing the XML file. This has obvious benefits, such as random access on the entire tree, but also has drawbacks, mainly that the complete tree has to reside in memory which for large files can be rather large as well and the fact that the complete file has to be parsed before you can begin working on the data itself.
SAX on the other hand is a serial approach which simply scans the XML file and generates events based on what syntactic elements it finds, such as starting tag, attribute, end tag, etc. You surely can create a tree structure from that information as well, but usually this approach is much more lightweight: You can start working on the data as the document is read and parsed and don't have to wait until it's all done. However, you can't access the whole tree if you want to. You can jump forwards or backwards within the tree, etc.
The ideal approach for parsing an XML document depends on your specific application needs. If you have to look at arbitrary places in the tree at differing points in time, then obviously DOM is the best way. However, if your XML document has a structure that lends itself well to reading from start to end and not having to go back again, then SAX should work. For XHTML display for example, SAX would be the right approach, even though you would still need an object model in the background. But for sole display purposes it's usually enough just to look at what tags come in and render them.
DOM and SAX are relatively speaking, old technologies, for latest ones check out STaX and VTD-XML