xml--Summary ③DTD Basic grammar (can read)

Source: Internet
Author: User

Iv. basic syntax of the DTD (read it)
1. DTD:Document Type Definition
2. Function:the writing specification for constrained XML.
3. When you save the DTD file to disk, you must use theUTF-8Coding

4. How to introduce an external DTD document to constrain the current XML document
DTD file inLocal: <! DOCTYPE root element name SYSTEM "DTD file path" >
DTD file inon the network:<! DOCTYPE root element name public "DTD name", "DTD path URL" >

5. Syntax details for DTDs
5.1 defining elements
Syntax: <! Element name Usage Rules >
Usage Rules:
(#PCDATA): Indicates that the body content of an element can only be normal text. (Parsed Character Data)
EMPTY: Indicates that the element cannot have a principal content.
Any: Used to indicate that the body content of an element is of any type
(child Element): Indicates the child element contained in the element
If the child elements are separated by commas, the XML document must be written in the order in which they are declared
If the child element uses the "|" Separate, explain any choice.
With +, *,? To indicate the number of occurrences of an element
5.2 Defining the attributes of an element (attribute)
Syntax: <! Attlist which element's properties
Property Name 1 property value type setting description
Property Name 2 property value type setting description >
Property value type:
CDATA: Describes the value of this property as a normal text
Enumerated (DTD does not have this keyword):
Syntax: <! attlist element Name (value 1| value 2) "Value 1" >
ID: The value of the property cannot be duplicated
Setting Description:
#REQUIRED: Indicates that the property must appear
#IMPLIED: properties are optional
#FIXED: Indicates that the value of the property is a fixed value syntax: #FIXED "fixed value"
Direct value: Indicates that the value of the property is the default value
5.2 Defining Entities
Keyword entity
Entity definitions are divided into reference entities and parametric entities
Referencing entities:
Role: Defined in a DTD, used in XML
Syntax: <! Entity entity name "Solid content" >
Use the:& entity name in XML;
Parameter entities:
Role: Defined in DTD, used in DTD
Syntax: <! Entities% entity name "Entity Content" >
Used in DTD:% entity name;

xml--Summary ③DTD Basic grammar (can read)

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.