Parsing XML text with MSXML

Source: Internet
Author: User
Tags define format definition object model requires xml parser xsl

First, the introduction

The popular script language currently on the Web is HTML-oriented language structure, HTML is a markup language, not a programming language, the main markup is for display, not for the document content itself structure description. In other words, the machine itself is not able to parse its contents, so there is an XML language. The XML (extensible Markup Language) language is a subset of the SGML language, which retains the primary use of SGML while significantly reducing the complexity of SGML. The purpose of the XML language system is to make it not only can represent the content of the document, but also can represent the structure of the document, which can be understood by the machine at the same time. XML requires adherence to certain stringent standards. XML parsers are more critical of syntax and structure than HTML browsers, and XML requires that the Web pages being created use syntax and structure correctly, rather than HTML, to speculate about what should be in the document to make HTML display. XML makes parsing programs easier to implement, both in terms of performance and stability. Each time the XML document is parsed in a consistent way, unlike HTML, different browsers may make different analysis and display of the same HTML.

At the same time, because the analyzer does not need to spend time rebuilding incomplete documents, they can perform their tasks more efficiently than similar HTML. They can do their best to build a tree based on the tree structure already contained in the document, rather than displaying it on the basis of a mixed structure in the information flow. The XML standard is a processing application of data, not just web pages. Any type of application can be built on top of the analysis program, and the browser is just a small part of XML. Of course, browsing is still extremely important because it provides XML workers with a friendly tool for reading information. But for bigger projects it's just a display window. Because XML has a strict syntax structure, we can even use XML to define a communication protocol for an application layer, such as the Internet Open Trade Protocol (Internet Open Trading Protocol), which is defined by XML. In a sense, some of the protocols and formats that we used to define in the BNF paradigm can be defined in principle in terms of XML. In fact, if we are patient enough, we can use XML to define the specification of a C + + language.

Of course, XML allows for the free development of a large number of HTML styles, but it is more stringent in terms of rules. XML has three main elements: DTD (document type declaration--) or XML Schema (XML outline), XSL (extensible Stylesheet language--Extensible Style language) and XLink (extensible link language--extensible linking language). The DTD and XML outlines define the logical structure of the XML file, defining the relationships between the elements in the XML file, the attributes of the elements, and the attributes of the elements and elements; Namespace (name Domain) implement unified XML document data representation and data integration XSL is the language used to specify the presentation of XML documents, which makes the data independent of its representations, such as XSL, which enables the Web browser to change the presentation of the document, such as changes in the display order of the data and no need to communicate with the server. By changing the style sheet, the same document can be displayed larger, or folded to show only a layer, or can become printed in a format. And XLink will further expand the existing simple links on the web.

Second, the implementation of XML parsing instructions

Of course, theoretically, according to the format definition of XML, we can write an XML parser ourselves, but in fact Microsoft has provided us with an XML parser, and if you install the IE5.0 version, you actually have the XML parser installed. You can download the latest MSXML SDK and parser files from the Microsoft site (www.microsoft.com). It is a dynamic-link library called MSXML.DLL, the latest version of MSXML3, which is actually a COM object library that encapsulates all the necessary objects for XML parsing. Because COM is a language-independent reusable object that appears in binary format. So you can invoke it in any language (such as vb,vc,delphi,c++ Builder, or even script language, etc.) to implement parsing of XML documents in your application. The following introduction to the XML Document Object model is based on Microsoft's newest MSXML3.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.