Chapter 2 Document Type Definition DTD

Source: Internet
Author: User

Defining document encoding is absolutely necessary, otherwise Chinese characters cannot be displayed:

<? XML version = "1.0" encoding = "gb2312" ?>

Generally, labels in XML are in uppercase and attributes are in lowercase.

<! -- Use DTD (Document Type Definition) in three forms: -->

<! -- 1. When a local file is used, it will automatically search -->
<! Doctype document system "My. DTD" >

<! -- 2. Use remote files -->
<! Doctype document system "http: // mysite/My. DTD" >

<! -- 3. Declare a public DTD
Usage:
<! Doctype document public [FPI] [DTD]>
Here, FPI is a formal public identifier:
-(Custom) | + (non-standard group approval) // organization name // type & version/Language
DTD is the link to the DTD file.
-->
<! Doctype HTML public "-// W3C // dtd html 4.01 transitional // en"
Http://www.w3.org/TR/html4/loose.dtd" >

<! --Internal DTD call method:-->
<!Doctype document root element [
Document Type Definition (same as external files)
]>

Several methods of element declaration:

<! -- 1. String Element -->
<! Element (# pcdata) >

<! -- 2. element of the tape Element -->
<! Element element name (child element 1, child element 2) >

<! -- 3. The above two mixed Elements
It will be valid if it is a string, a sub-element, or both. -->
<! Element element name (# pcdata | child element name) >

<! -- 4. Empty or any element
Empty indicates that this element cannot contain any content; Any indicates that this element is always valid. -->
<! Element element name: empty >
<! Element element name: empty >

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.