Combine the database with XML to reduce the server
Date: 2002-12-22 16:47:36 Source: - Author: - Today, the database has become the soul of the site, it can be said, there is no centralized data management is not really a real website. And the ASP plus database, has become the mainstream mainstream, the user logs in, the forum, the message book has become the place where they use Wuzhi, and it can be used by 51 files. Now it is possible to use 2 files. But the ASP adds the database, but not perfect, especially frequently with the server.
For example, according to the ASP database program, we can simplify the job of the dedicated webmaster into two files: a database file, record all the chapters of the novel; another ASP file, used to read the content of the database; When you click on "Next chapter", you can browse the next chapter ... it is true, this seems to be very intuitive, but not, every time we browse the next chapter, our browser will automatically I consciously visited a database, so when some visits were read patiently, our database had been intimate with it 49 times. If there is N 49 times at the same time? Who can guarantee that your server still causes all requests? In particular, some of the phenomena that provide search data, the website displayed, the server is overwhelmed, because the query results have n pages, indicating that the visitors are required to connect the server to play n times.
If you say "N times, n times, it doesn't matter", then you should immediately click on the browser "back" because I will talk about some garbage content. Of course, if you want your database program to become "N page records, once interactive", welcome to continue, we will explore the integration of XML and databases.
In fact, XML is not empty as many people think, without practical use. I don't know if you think so, but it's hard to see some websites that really apply an XML. This is a fact. Now, I have listed several cases of XML to implement, I hope to prove the use of XML and powerful:
1. 1 XML file 1 ordinary html file = 49 chapter novel display applies to those ordinary homepage spaces that do not support ASP, this case XML completely replaces the database, very classically to achieve data and typesetting . XML is completely divided with HTML.
2. 1 XML file 1 to n ASP file = message / forum applies to the ASP homepage space for file components FileSystemObject and database components, no file access and database, can do a message and forum with XML And implement all the functions of the database. (I published in this forum "The third way ----- Based on XML ASP Message Board", this technology can be searched in detail. If you are interested, you can search this article in the forum.)
3. 1 database 1 ASP file embedded in XML = "N page record, one interaction"
It can be said that these technologies reflect the essence of XML. Especially the second technology, XML fully demonstrates its own advantages - existing databases of powerful and text files (one .mdb file hundred k, one .xml file only a few K, and database file modification With expert software or corresponding ASP programs, but XML files, notepads are enough.) More exciting is that XML can throw away file access components and database components to read, and even create new files . And we will talk about "N-page records, once interactions" is more comprehensive transcendence of XML on the database. First look at the XML file below:
XML Version = "1.0" encoding = "GB2312"?>
This is a legal XML document, and the rules and format of the XML document are also very free. If you want to create a new XML file, just change the first line of " XML Version =" 1.0 " Encoding = "GB2312"> ", while the next label and the tag can be very casual, only follow the rules:
1. The first label must correspond to the tail label, but it can be repeated, but it is not possible. 2. Label naming rules are similar to variable naming rules such as program languages such as Java / C / C , which is case sensitive. 3. One document can only have one root element, such as "
OK, we already know how to write a legitimate XML document, the next step we will begin to explore the XML file into the HTML file and operate the data in the XML document with the VBScript scripting language. First look at the following file: