XML creates documents that other applications can use, any program that can read and process XML document is called an XML processor. There are so many examples of XML processors.
The examples are:
- Web Browsers
- XML Editors
- Validity Checkers
- Data archiving systems and so on.
A parser is the fundamental XML processor that converts an XML document into internal representation for programs or subroutines to use. This parser is an important part of XML processing applications.
Parser takes a stream of characters from the file and turn it into meaningful groups called tokens.
Tokens are interpreted as either event to drive the program or built into a structure in memory(like a tree structure) for program to use.
Strict Rules for Validity
XML processors are very strict and does not allow missing markups or wrong tags in the document, it cannot allow uppercase elements when it should be lowercase. In short, the document should be well-formed. If an error is found, the parser will stop further processing, until the problem is fixed.
HTML document allows missing tags and incomplete tags and ignores it. It can fix the missing tag; the XML processor don’t allow such thing to make the working of XML parser as predictable as possible.
XML documents are used in variety of applications and must work in the same way every time, if there are even minor errors, that will be difficult to fix later, and to prevent such situation, the XML parsers are strict.