File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change 22
33## 介紹
44- dtd 語法:
5- ```
5+ ``` xml
66<!ELEMENT 元素名稱 約束>
77```
88- schema 符合 xml 的語法,xml 語句。
2121- 看 xml 中有多少個元素 -> element
2222- 複雜元素
2323
24- ```
24+ ``` xml
2525 <element name =" person" >
2626 <complexType >
2727 <sequence >
3131 </element >
3232 ```
3333- 簡單元素(寫在複雜元素的中間)
34- ```
34+ ```xml
3535 <element name =" person" >
3636 <complexType >
3737 <sequence >
4343 ```
4444
4545- 在被約束文件裡面引入約束文件
46- ```
46+ ```xml
4747 <person xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
4848 xmlns =" http://www.example.org/1"
4949 xsi : schemaLocation =" http://www.example.org/1 1.xsd" >
5959- **choice 標籤:** 元素只能出現其中一個。
6060- **maxOccurs="unbounded":** 表示出現次數沒限制。
6161
62- ```
62+ ```xml
6363 <element name =" name" type =" string" maxOccurs =" unbounded" ></element >
6464 ```
6565- **any 標籤:** 表示任意元素。
6868 type: 屬性類型。
6969 use: 屬性是否必須出現。
7070
71- ```
71+ ```xml
7272 <attribute name =" id1" type =" int" use =" required" ></attribute >
7373 ```
7474- 複雜的 schema 約束
7575 引入多個 schema 文件,可以給每個起一個**別名**
7676 想要引入特定約束文件裡的元素,使用 **別名:元素名稱**。
7777
78- ```
78+ ```xml
7979 <company xmlns =" http://www.example.org/company"
8080 xmlns : dept =" http://www.example.org/department"
8181 xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
You can’t perform that action at this time.
0 commit comments