To avoid the difficulties inherent in parsing raw XML input, almost all programs that need to process XML documents rely on an XML parser to actually read the document. The parser is a software library (in Java, it's a class) that reads the XML document and checks it for well-formedness. Client applications use method calls defined in the parser API to receive or request information that the parser retrieves from the XML document.
The parser shields the client application from all of the complex and not particularly relevant details of XML, including
Transcoding the document to Unicode
Assembling the different parts of a document divided into multiple entities
Resolving character references
Understanding CDATA sections
Checking hundreds ...