Use of custom XML controls on the. net platform (3)
Source: Internet
Author: User
?? In order to better understand the above code, we will give an example here, to trust readers at a glance :?? <Menusxmlns = 'x-schema: Menu. xdr '> ?? <Menuid = 'menubar1'> ?? <Topmenuid = "xjtu" text = "xjtu" isparent = "true" l ?? To better understand the above code, let's take an example here to show you how to trust the reader:
?? <Menus xmlns = 'x-schema: Menu. xdr '>
?? <Menu id = 'menubar1'>
?? <Topmenu id = 'xjtu' text = 'xjtu' isparent = 'true' linkurl = 'xjtu'> </topmenu>
?? <Topmenu id = 'sohu' text = 'sohu' isparent = 'false' linkurl = 'sohu'> </topmenu>
?? </Menu> </menus>
?? 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, it is an ASP.net component, so 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)
?? In fact, no matter the code at A or the clarification at B, it can be determined by. NET platform is born. if other platforms are applied and the code is not supported, you can manually add the code. After adding it, you can apply it with other controls. In addition, for all the public member variables in the control class code, the function distinguishes the attributes and methods corresponding to the control.
?? The control must provide two attributes: XmlStream and XmlFile. if you have created an XML file for the control (this file describes the Control Data ), if you have already written an xml code, you can pass the code and files out-of-band to XmlStream and XmlFile. the background program (that is, the dll file) reads XML data by calling xml browsers such as XmlTextReader, in this way, the control supports xml attributes, and the portability and versatility of the control are also enhanced.
?? This article mainly discusses xml in. from the examples above, we can see that xml has a unique advantage in data integration and processing, if your project involves data processing and cross-platform titles, you can consider using XML.
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