By Joe Stegman
Translation: Qiu Feng
Source: http://windowsforms.net/articles/wfml.aspx
Original name: Using the Windows Forms XML Parser Sample
Download Code: download
Introduction
Here is an example with a scalable mechanism, which is implemented by adding a tag model. The parsing rules can be summarized as "XML elements are mapped to. NET Framework types, and XML attributes are mapped to type attributes, methods (or events )". This example contains a markup parser that dynamically generates an object instance tree by parsing an XML file. The tag format includes the following structure:
1. Mappings between XML namespaces and. NET Framework namespaces
2. Object instantiation name
3. Object verification and reference
4. Attribute settings
5. Instance and static method
6. Event delegation
7. Component reference
Disclause
The technology used in this example is not part of the next version of Windows Forms. In addition, the example here is for. NET Framework version 1.1 and has not been tested in other versions.
Basic Sample
The following example shows an XML syntax used to declare or define a simple form containing a Label.
Xml version = "1.0" encoding = "UTF-8"?>
Mapping xmlns = "http://www.microsoft.com/2003/WindowsForms"
Namespace = "System. Windows. Forms; System. Drawing"?>
<Wfml xmlns = "http://www.microsoft.com/2003/WindowsForms"
Xmlns: wfml = "http://www.microsoft.com/2003/WFML">
<Form wfml: root = "true" Text = "Basic Sample" Size = "300,200">
<Label Text = "Hello World" AutoSize = "True" Location = "10, 20"/>
<Method. Show/>
Form>
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.