当前位置:网站首页>DTD modeling
DTD modeling
2022-06-30 19:03:00 【Yilin YL】
Catalog
XML Data structure of —— Tree structure :
1. stay XML Add DTD Statement :
2. The classification of elements :
3. The limitation of elements :
What is? DTD?
Document type definition (Document Type Definition) Is a set of syntax rules about markers established for data exchange between programs . It is the standard general purpose markup language (SGML) And extensible markup language (XML)1.0 Part of the version specification , Documents can be based on DTD Syntax rules verify whether the format conforms to this rule . The document type definition can also be used as a guarantee standard common markup language 、 The legitimacy of XML document format , You can check whether the document conforms to the specification by comparing the document with the document type definition file , Are elements and labels used correctly . The file instance provides a data exchange format for the application .
PS: In short ,DTD It's used to constrain XML Document , Make it used under certain specifications , except DTD Outside technology , also Schema technology , Also for constraints XML Document .
What is? XML?
XML,Extensible Markup Language, Extensible markup language . The suffix of the file is .xml. It's like HTML Is used to display data ,xml The role of is Transfer and store data Of .
XML What is it for ?
In fact, it's plain ,xml It is convenient for different applications 、 Data sharing and communication between different platforms .
As shown in the figure below :

The functions of the specific points are :
(1) It can be used as a simple database , Store and retrieve data ;
(2) Transfer files in the agreed format ;
(3) Make software configuration files .【 The configuration file : Save the file of software settings 】
XML The relatives of :
1.XML My good brother ——HTML
① Let's take a look at their birth order :

Actually XML I was born to perfect HTML Defects and localities of .
② Differences in use :
| Compare content | HTML | XML |
| effect | Display the data | Transfer and store data |
| grammar | No right-hand requirements | Nesting required 、 pairing , And follow DTD Tree structure of |
| Space | When more than one is entered, only One | Enter several to display several |
| Relationship with database | No direct connection | It can correspond and transform with relational and layered databases |
| Case sensitive | Indistinguishes | Strictly distinguish between |
2.XML My best friend ——JSON
Is this relationship easier to understand : My brother was born to a mother , But girlfriends are not .
JSON,Javascript Object Notation,js Object notation . The function is also to store and exchange text information .
A comparison of the two : because ,JSON Use the format of key value pairs , therefore ,JSON Than XML smaller 、 faster 、 Easier to parse ,so, It is also more popular .
The scope of action of both :JSON It is suitable for simple value transfer ,XML It is suitable for wider value transmission .
XML Data structure of —— Tree structure :

Be careful : Like a tree with only one root ,XML There can only be one root element .
XML Standard format :

Element definition :
1. stay XML Add DTD Statement :
<!DOCTYPE root[]>2. The classification of elements :
① Empty elements
<!ELEMENT element-name EMPTY>② Text elements
<!ELEMENT element-name (#PCDATA)>③ Mixed elements
<!ELEMENT element-name (e1,e2)>3. The limitation of elements :

ps: The default number of times is ?
Attribute definitions :
1. grammar :
<!ATTLIST element-name att-name type desc>2. Attribute types :
| ID | Require all tags in the document ID Property values of types must not be the same |
| Enumerated | You must select... From the enumerated data types , Such as (true|false), You can also leave the type blank , Written directly (true|false) |
| CDATA | Property values of this type cannot contain “<” and “””, But entities can appear in this string |
| IDREF | Used to represent XML A type of relationship between tags in a document , Its value must be the value of a tag defined in the document ID Property value of type |
| IDREFS | Be similar to IDREF, But you can reference more than one ID, Multiple ID Space between |
3. Property description :
- #REQUIRED: Required
- #IMPLIED: Not required
- The default value is : Only when the attribute type is Enumerated When ,desc To specify the default value .
Case study :
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE persons[
<!ELEMENT persons (person+)>
<!ELEMENT person (name,age,contact,br*)>
<!ELEMENT name (#PCDATA)>
<!ELEMENT age (#PCDATA)>
<!ELEMENT contact (phone|email)>
<!ELEMENT br EMPTY>
<!ATTLIST person
pid ID #REQUIRED
sex ( male | Woman ) ' male '
qq CDATA #IMPLIED
parent IDREF #IMPLIED
>
]>
<persons>
<person pid="p1" sex=" male " qq="aaa" parent="p2">
<name> Zhang Xiaoming </name>
<age>10</age>
<contact>
<phone>1234567</phone>
</contact>
<br/>
</person>
<person pid="p2">
<name> Zhang Daming </name>
<age>35</age>
<contact>
<email>[email protected]</email>
</contact>
</person>
</persons>All right. , See you next time , If there is anything to add, please leave a message in the comment area !
边栏推荐
猜你喜欢

How to solve the lock-in read-only alarm of AutoCAD Chinese language?

The online procurement system of the electronic components industry accurately matches the procurement demand and leverages the digital development of the electronic industry

Reading notes of "high EQ means being able to talk"
![Delete duplicate elements in the sorting linked list ii[unified operation of linked list nodes --dummyhead]](/img/dd/7df8f11333125290b4b30183cfff64.png)
Delete duplicate elements in the sorting linked list ii[unified operation of linked list nodes --dummyhead]

领导:谁再用 Redis 过期监听实现关闭订单,立马滚蛋!

AI chief architect 10-aica-lanxiang, propeller frame design and core technology

Personally test the size of flutter after packaging APK, quite satisfied

Swin-Transformer(2021-08)

Solution of enterprise supply chain system in medical industry: realize collaborative visualization of medical digital intelligent supply chain

Detailed single case mode
随机推荐
CODING 正式入驻腾讯会议应用市场!
详解单例模式
How does rust implement dependency injection?
联想YOGA 27 2022,超强配置全面升级
Merged binary tree of leetcode
Rust 文件系统处理之文件读写 - Rust 实践指南
dtd建模
这里数据过滤支持啥样的sql语句
Reading notes of "high EQ means being able to talk"
挖财账号开户安全吗?是靠谱的吗?
【TiDB】TiCDC canal_ Practical application of JSON
What if icloud photos cannot be uploaded or synchronized?
Geoffrey Hinton: my 50 years of in-depth study and Research on mental skills
Glacier teacher's book
GameFi链游系统开发NFT技术
MySQL找不到mysql.sock文件的临时解
Solution of enterprise supply chain system in medical industry: realize collaborative visualization of medical digital intelligent supply chain
Dlib library for face key point detection (openCV Implementation)
一文详解|Go 分布式链路追踪实现原理
Is it safe to open a mobile stock account? Is it reliable?