Use of custom XML controls on the. net platform (2)

Source: Internet
Author: User
The second step is to participate in XML feature attention. it is best to verify the effectiveness of any xml document before it is processed. supply verification generally has two important ways. One is to supply DTD (Document Type Definition), which is to allow users to provide instruction sets.

Step 2: Participate in XML features

Note that it is best to verify the validity of any xml document before it is processed. supply verification generally has two important ways. One is to supply the DTD (Document Type Definition), which is to allow the user to provide the instruction set, and then analyze the validity of the xml document when it is loaded to check whether there are invalid instructions, in short, it is to create a compiling environment; the other is to provide a so-called schema .. Its function is the same as that of DTD, but its performance is better than that of DTD, because it is also an XML document. Here I use schema. of course, readers can also change it to the corresponding DTD version. The code about the control and topmenu object of the schema is listed below. if you want to view the specific code of this document, please refer to authorization code .doc ".

Reference content is as follows:
Menu. xdr:

??

??

??

?? Menus schema used to validate menu. XML

??

??

??

??

??

??

 

??

??

??

??

??

??

??

??

??

??

??

 

??

??

??

??

??

??

??

??

??

??

??

 

??

??

??

??

??

??

??

??

??

??

??

??

??

??

??

??

??

??

If you are familiar with html, trust the code above, even if you have never touched it before. in xdr, there are two objects. one is the element defined by the prefix ElementType, and the other is the attribute corresponding to the element. After defining the two objects with the prefix atttibuteTpye, it is to instantiate them, and the corresponding prefix is identified as Element and atttivity. then you can apply these two types of instantiated objects, just as in the application html, ,,.

To better understand the above code, let's take an example here to show you how to trust the reader:

Reference content is as follows:

??

??

??

??

??

??

After creating the xml document, you need to read the xml document in the program. if you use Microsoft's vs.net platform for development, we suggest you use XMLTextReader to read the relevant information. for details, refer to MSDN.

Step 3: apply controls

After the menu control is created, it is applied under the. net platform. First, compile the control on the vs.net platform. if the control is compiled successfully, you can apply it. Application.. net custom controls are similar to ActiveX controls in applications. start the component box under the vs.net platform (you can right-click the ToolBar to get it) and check whether the COM component is created, but ASP.. NET component. Therefore, it is essentially different from the COM component. you can use the Browse button to select the dll file corresponding to the control and add it to your project. Next you need to participate in the following code in your program code (other code is omitted)

Using your namespace; ()

You should also participate in the Declaration of the control in behind code (B)

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.