人人做人人澡人人爽欧美,国产主播一区二区,久久久精品五月天,羞羞视频在线观看免费

當前位置:蘿卜系統下載站 > 技術開發教程 > 詳細頁面

XML在.net平臺下的自定義控件的應用(2)

XML在.net平臺下的自定義控件的應用(2)

更新時間:2022-08-23 文章作者:未知 信息來源:網絡 閱讀次數:

第二步,就是加入XML特性

注意,任何xml文檔在其被處理之前最好先進行有效性驗證,提供驗證一般有兩種重要的途徑。其一就是提供DTD(文檔類型定義),實際上就是讓用戶提供指令集,然后在xml文檔加載的時候對其進行有效性分析,看是否有無效指令,簡單說就是創建一個編譯環境;另外一個就是提供一個所謂的schema。.其作用跟DTD完全一樣,只是在表現形式上好于DTD,因為它本身也是一個XML文檔。這里我采用了schema的形式,當然了,讀者用興趣也可以將其替換問相應的DTD版本。下面列出該schema的關于控件和topmenu對象的代碼,如果要看該文檔的詳細代碼,請看 “代碼.doc”。

menu.xdr:

<?xml version="1.0" encoding="UTF-8"?>

<Schema name="menus" xmlns="urn:schemas-microsoft-com:xml-data" xmlns:dt="urn:schemas-microsoft-com:datatypes">

<description>

menus schema used to validate menu.xml

</description>

<ElementType name="menu" model="closed" content="empty">

<AttributeType name="id" dt:type="string" required="yes"/>

<atttibute type="id"/>

<element name="topmenu" model="closed" minOccurs="0" maxOccurs="*" content="empty"/>

</ElementType>



<ElementType name="topmenu" model="closed" content="empty">

<AttributeType name="id" dt:type="string" required="yes"/>

<AttributeType name="text" dt:type="string" required="yes"/>

<AttributeType name="linkurl" dt:type="string" required="yes"/>

<AttributeType name="isparent" dt:type="string" required="yes"/>

<atttibute type="id"/>

<atttibute type="text"/>

<atttibute type="linkurl"/>

<atttibute type="isparent"/>

<element name="submenu" model="closed" minOccurs="0" maxOccurs="*" content="empty"/>

</ElementType>



<ElementType name="submenu" model="closed" content="empty">

<AttributeType name="id" dt:type="string" required="yes"/>

<AttributeType name="text" dt:type="string" required="yes"/>

<AttributeType name="linkurl" dt:type="string" required="yes"/>

<AttributeType name="isparent" dt:type="string" required="yes"/>

<atttibute type="id"/>

<atttibute type="text"/>

<atttibute type="linkurl"/>

<atttibute type="isparent"/>

<element name="childrenmenu" model="closed" minOccurs="0" maxOccurs="*" content="empty"/>

</ElementType>



<ElementType name="childrenmenu" model="closed" content="empty">

<AttributeType name="id" dt:type="string" required="yes"/>

<AttributeType name="text" dt:type="string" required="yes"/>

<AttributeType name="linkurl" dt:type="string" required="yes"/>

<AttributeType name="isparent" dt:type="string" required="yes"/>

<atttibute type="id"/>

<atttibute type="text"/>

<atttibute type="linkurl"/>

<atttibute type="isparent"/>

<element name="menuitem" model="closed" minOccurs="0" maxOccurs="*" content="empty"/>

</ElementType>

<ElementType name="menuitem" model="closed" content="empty">

<AttributeType name="id" dt:type="string" required="yes"/>

<AttributeType name="text" dt:type="string" required="yes"/>

<atttibute type="id"/>

<atttibute type="text"/>

</ElementType>

</Schema>

如果您對html比較熟悉的話,相信上面的代碼即使是以前沒有接觸過也應該清楚了,在.xdr中,有兩個對象,其一是元素,用前綴 ElementType 來定義,另外一個是該元素所對應的屬性,用前綴atttibuteTpye,定義完這兩個對象后,就是要將它們實例化,對應的前綴分別是Element 和atttibute,然后您就可以使用這兩種已經實例化了的對象,就象使用html中<a>,<l>,<body>,<head>等標記一樣。

溫馨提示:喜歡本站的話,請收藏一下本站!

本類教程下載

系統下載排行

網站地圖xml | 網站地圖html
主站蜘蛛池模板: 通城县| 石门县| 丰城市| 黑龙江省| 磴口县| 昭通市| 阜阳市| 江山市| 阿城市| 东海县| 衡阳市| 石渠县| 雷州市| 肇庆市| 台湾省| 黔南| 岱山县| 萨嘎县| 鹰潭市| 巴林左旗| 上思县| 芒康县| 永城市| 昔阳县| 大邑县| 彝良县| 新和县| 康平县| 盐城市| 余庆县| 特克斯县| 合肥市| 中方县| 汶川县| 嘉义市| 澄迈县| 婺源县| 义马市| 蓝山县| 宿州市| 凤山市|