Xml 简明教程

XML - Parsers

XML parser 是一个软件库或一个包,它提供接口,让客户端应用程序能够处理 XML 文档。它检查 XML 文档是否格式正确,还可以验证 XML 文档。现代浏览器具有内置的 XML 解析器。

XML parser is a software library or a package that provides interface for client applications to work with XML documents. It checks for proper format of the XML document and may also validate the XML documents. Modern day browsers have built-in XML parsers.

下图显示了 XML 解析器如何与 XML 文档进行交互 −

Following diagram shows how XML parser interacts with XML document −

xml parser

解析器的目标是将 XML 转换称可读代码。

The goal of a parser is to transform XML into a readable code.

为了简化解析过程,一些商用产品可用于促进 XML 文档的分解并产生更可靠的结果。

To ease the process of parsing, some commercial products are available that facilitate the breakdown of XML document and yield more reliable results.

以下是常用的一些解析器:

Some commonly used parsers are listed below −

  1. MSXML (Microsoft Core XML Services) − This is a standard set of XML tools from Microsoft that includes a parser.

  2. System.Xml.XmlDocument − This class is part of .NET library, which contains a number of different classes related to working with XML.

  3. Java built-in parser − The Java library has its own parser. The library is designed such that you can replace the built-in parser with an external implementation such as Xerces from Apache or Saxon.

  4. Saxon − Saxon offers tools for parsing, transforming, and querying XML.

  5. Xerces − Xerces is implemented in Java and is developed by the famous open source Apache Software Foundation.