Introduction to Parsers

Web applications exchange XML documents to share data. However, XML documents contain data and XML constructs such as elements, attributes, or namespace declarations that applications cannot understand. Therefore, applications use parsers to extract data from an XML document.

For example, an application receives an XML document that contains the following namespace declaration:

   xmlns:pre=”http://www.mysite.com/partner”

A parser can identify the XML constructs within the namespace declaration. The parser can recognize that the namespaceURI,
”http://www.mysite.com/partner”, might not be a valid web site. The parser can also identify that the prefix pre replaces the long namespaceURI in the XML document to provide unique names to the elements and attributes in the document. Similarly, parsers can analyze and ignore other XML constructs, such as tags, to extract the required data for applications.

The graphic shows how web applications use parsers to extract data from XML documents.
Click the Next button to continue.