XML programming example: use ASPXML to create a message book

Source: Internet
Author: User
I. readers guide readers to help you grasp the synopsis of this article. So that you do not understand that this article is not suitable for you and may cause visual pollution to you. If you are writing some programs using ASP + XML, or you are learning XML, it is worth reading. Browse Book

I. Reader guide

Reader guide helps you grasp the synopsis of this article. So that you do not understand that this article is not suitable for you and may cause visual pollution to you.

If you are writing some programs using asp xml, or you are learning XML, it is worth reading.

The knowledge required to browse this article, the basic understanding of ASP, and the basic understanding of XML and DOM. if you do not understand it, you can
Supports the use of ASP + XML and DOM, and can write more advanced ASP + XML programs according to this article.

II. basic ideas

The idea of this article is to use ASP and DOM to read and store XML data, and use XML data to store message information, to achieve the same purpose of storing data in databases.
Yes.

III. Advantages of XML message Books

Maybe you will ask that using ASP + TXT text can also achieve the function of not having to use the database to actually leave a message, which is good and can indeed be done, and there are also a lot of such issues on the Internet
This is free to download, but here I want to talk about the superiority of ASP + XML.

1. XML + ASP is faster than ASP + TXT. You may also find that the speed is surprisingly fast when there are few TXT files, but as the message information increases
The speed is surprisingly slow, which is the weakness of ASP + TXT. Of course, I cannot say that ASP + XML must be surprisingly fast,
P + TXT is much faster. of course, with the increase of message information, the XML text increases rapidly, but it is much better than TXT.
(This can be verified by the WAS test.) of course, ASP + XML is not as good as the database.
While XML is only plain text. setting up a pair in ASP is like reading all the XML data into the memory. if the data volume is large, it can be imagined that the speed will slow down.
Then you may ask, when will I use relational databases to store data and XML to store data? By the way, we can compare the data.
It is appropriate to use XML data for Complex random rates, and when you plan to read the data from applications on different control systems, it is the time for XML to show its strength.
. If you are using common data, do not use XML files to store data when it is not critical or does not support database space.

2. XML data is easy to read. TXT text is relatively difficult to control. we must read and determine a row by row. In addition, many functions cannot be implemented and can only be edited.
Compared with the simple message book, XML data is different. DOM can be used to easily visit every node, rather than the annoying Readline () of TXT ()
Witeline () is now available. we can delete and update a node that we like and use ASP, JS, or data Island to easily implement this node.
Point, of course, I will consider compatibility here. I use ASP to read XML data, instead of data Island to read node data (because only IE5 or later versions are available
Support data Island skills) but ASP does not actually exist because the customer gets HTML files.

3. XML data is dominant in the system. as long as we store the data as XML, the data can be identified by the language or system.
What should be corrected. TXT obviously does not have these performances. For example, our messages on the Internet can be directly converted to wap and displayed on the mobile phone.
4. create an XML file (List. xml) for storing message information)

We do not intend to apply the DTD here. because we have compiled and tested the XML data, we do not need the DTD for verification.
You can add one that does not affect the running of the program ). Now let's take a look at the basic elements of creating a message book.

Reference content is as follows:

0. message id -- defined as <id>

1. username -- defined as <username>

2. from there -- defined as <fromwhere>

3. set the message time to <Posttime>

4. set the user homepage to

5. user mailbox-defined as <email>

6. set the message content to <text>

Of course, the above is not necessary for readers to name and add or subtract the corresponding tags, and combine them to get the List. xml file.

Reference content is as follows:
<? Xml version = "1.0" encoding = "gb2312"?>
<Site>
<NewList>
<List>
<Id> 1 </id>
<Username> Example </username>
<Fromwhere> Guangzhou, China </fromwhere>
<Posttime> 01-4-23 18:26:56 </Posttime>
<Homepage> http://page2000.xiloo.com <Email> lucaihui@cmmail.com </email>
<Text> This is my first XML file </text>
</List>
</NewList>
</Site>

Note: encoding = "gb2312" must be added; otherwise, an error is returned because XML does not support Chinese characters by default. <Site> It is the root node <NewList>
<Ist>. I have not said much about the meaning of this file. you should also understand it. The next step is how to display it.



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.