I. Introduction to XML
Lift XML (Extensible Markup Language Extended Markup Language), I believe that the industry will not be unfamiliar, as a computer technology is just a few years, with its simpleness.
Let's take a simple example:
XML Version = "1.0"?>
book>
book>
books>
From the data from the above image, we can see that such simple data, clearly describes the information of two books, including the type of book, the author, and title. Since XML can be understood as a formatted text, for XML, there is no operating system concept, as long as it supports text processing machine, you can get the required data from XML, and, with general text Different, XML itself has a certain data structure, with techniques to read XML format documents (such as traditional SAX (Simple API for XML), and DOM (DOCUMENT OBJECT Model) parsers, including later introduced Support for XML in .NET, it is convenient and quick to quickly process data in XML.
XML itself does not have much grammar requirements, as long as the mark corresponds to one or one, it is not nested. In addition, in order to meet some requirements for the integrity and security of the data itself, some related techniques such as DTD (Document Type Decation Document Object Model), XDR (XML Data Reduced), and XSD (XML Mode Definition Language) can be XML provides valid validation to ensure integrity of data in XML.
Second, XML technology in .NET
.NET as a new generation of development models launched by Microsoft, providing extremely perfect support for XML. It can be said that .NET does not provide support for XML, and its core is also closely combined with XML. We can take a look at the following aspects:
1, traditional analysis
Like other programming languages, .NET provides a very complete class library to support XML in the .NET (including C #, VB.NET, Host C , etc.) to write to XML. The program of reading and writing.
Note: These classes are located under System.xml Namespace, supports the XML document with SAX mode and DOM mode.
2, advanced analysis of the .NET
In addition to supporting traditional parsing methods, some techniques in .NET are also supported to parse XML data, such as the widely used DataSet in ADO.NET (data set stores data in disconnects. Data set Structure is similar to the structure of the relational database; it publics the layered object model of the table, rows and columns. In addition, it is constrained and relationship defined by the data set. It can be understood as a form of expression in the database), READXML (read XML architecture and data into dataset) and getXML (return to XML representation stored in DataSet.) And WRITEXML (from DataSet write XML data, you can also choose a write architecture.) Method for parsing XML . By using these methods, it can be effectively interacting with XML data in .NET.
3, XML verification
As mentioned earlier, there are now three ways to verify the XML: DTD, XDR mode and XSD mode. In .NET, it provides support for these three ways, where XSD (W3C Developed XML Mode Definition Language) mode, .NET Framework provides a wide range of support.
Of course, this does not mean that DTD and XDR mode are inconsistent with .NET Framework, in VS.NET contains some tools, these tools can help us convert XDR mode to XSD format.
Since the XSD standard is very long and complicated, as a widely supported standard in .NET Framework, VS.NET provides us with several tools that are easy to create an XSD mode, and we can optionally create the required XSD mode. :
1) Use XML Designer from the beginning to create a time;
2) Use Server Exploreer to create from a database;
3) Create from an XML document or XDR mode using XSD Generator;
In addition, the XSD mode also follows XML syntax, so we can also use Microsoft SOM (Schema Object Model Mode Object Model) to modify SOM object tree in memory, and write this mode to disk file to achieve dynamic modification The purpose of XSD mode.
4, XML serialization
Of course, the role of XML is not allowed. When a distributed system is created, a portion that must be resolved will get a portion of the system to another to another.
In order to meet this demand, .NET Framework implements an XML-based serial mechanism that you can serialize an object to an XML format, so that all public domains and properties will be written in XML format. Then you can send this XML data to anywhere you want, because XML is an open, waited for a widely supported standard.
At the same time, the XML data can be paid in the receiving end application, so that the object can be reconstructed in memory.
5, configuration in .NET
The above introduction to some general technologies used in .NET Framework, in fact, .NET itself is also related to XML interest, extensive use of XML in .NET Framework, using XML for application configuration.
There are three kinds of three:
1) Application configuration file
Such profiles indicate settings for a separate application, bind to information on the assembly, and the configuration of the remote object, etc. For example, an application is a standard .exe application, then the application's file name plus one .config extension.
For the web application of ASP.NET, the cultivated details will be stored in a file called web.config. A server can have multiple web.config files, each of the web.config files exists in the root of the application or in their subdirectory. 2) Machine or server profile
This is an XML file called Machine.config for system-wide configuration.
3) Security profile
This type of configuration file is used by the Framework security system to determine what license is received. A total of three configurable policy levels: enterprise-class, machine-level and support levels.
To read or modify these configuration information, you can use any standard text editor, an XML analyzer, or you can read the API of the configuration file and extended configuration files in a set of users provided in the .NET Framework.
Third, the future of XML technology
Although the use of XML technology has made many fields, the superiority of XML technology determines that it is inevitably used in more fields, such as in the next generation of database techniques, the XML database will appear, this database is different from now Some relationship databases can allow different amounts of information contained in the data of the same class.
For example, a library data, the hypothesis has 2 books, I hope to save the title, author, publishing house, price, and page number information, according to the existing relational database, possible storage mode:
Name
Author
Publish
PRICE
Pageno
1
.NET XML advanced programming
Wrox
Tsinghua University Press
75
676
2
XML advanced programming
Wrox
Mechanical Industry Press
95
944
If one of them I hope to save the title, author, publishing house, price, and page number information, and another one I only want to save the title, the author, and price information.
According to the existing relational database, the possible storage mode is:
Name
Author
Publish
PRICE
Pageno
1
.NET XML advanced programming
Wrox
Tsinghua University Press
75
676
2
XML advanced programming
Wrox
NULL
95
NULL
From the above figure we can see that there is no valid value in the second row of data in the existing relational database, but there is no valid value, but still use null to indicate certain data resources.
Now, let's take a look at how to use XML to represent this information:
First case: second case
XML Version = "1.0"?>
book>
book>
books>
XML Version = "1.0"?>
book>
From these two figures, we can see the use of XML description data, which provides the information we need, but in the second case, there is no information that does not need.
Of course, here is just a little advantage that uses this XML to save data. It is necessary to apply it to the database processing technology. However, Microsoft is already doing this, let us wait .
In addition, as a big direction in the future application of XML technology --XML Web Services is also unable to mention, the name is on the name, this technology and XML are closely tight. To use the web service is inseparable from XML, from WSDL ( Web service descriptive language) to SOAP (Simple Object Access Protocol) is described using XML.
However, based on Web service security, the major industry giants are currently developing a Web service-based security protocol, which is believed that Web Services will also be quite widely used in the near future.