Detailed introduction to document and declaration usage in XML

黄舟
Release: 2017-03-10 19:59:49
Original
1541 people have browsed it

This article mainly introduces the usage of documents and declarations in XML. It is the basic knowledge for introductory learning of XML. Friends who need it can refer to it

An XML document is an organized element and other tags The basic unit of XML information composed of. An XML _document_ can contain a wide variety of data. For example, in a numerical database, numbers represent molecular structures or mathematical formulas.

XML Document Example
A simple XML document example is provided below:



    Tanmay Patil
    TutorialsPoint
    (011) 123-4567
Copy after login


The following figure depicts the XML document part.
Detailed introduction to document and declaration usage in XML

Document Prologue
Document Prologue is at the top of the document, before the root element. This section contains:

XML Declaration

The XML declaration contains details that prepare the XML handler to parse the XML document. It is optional, but when used it must appear on the first line of the XML document.

Syntax
The following syntax shows the XML declaration:

Copy after login

Each parameter consists of the parameter name, the equal sign (=), and the parameter value wrapped in quotes. The following table shows the details of the above syntax:

Detailed introduction to document and declaration usage in XML

Rules
XML declarations should comply with the following rules:

If an XML declaration appears in XML , it must be placed on the first line of this XML document.
If an XML declaration is included, the version number attribute must be included.
Parameter names and values ​​are case-sensitive.
The order in which parameters are placed is important. The correct order is: version, encoding and standalone.
You can use single quotes or double quotes.
XML declaration has no closing tag, such as .

Examples of XML declarations

Here are some examples of XML declarations.

XML declaration without parameters:

Copy after login

XML declaration with version definition:

XML/HTML CodeCopy content to clipboard Board

Copy after login

XML declaration with all parameter definitions:

Copy after login

XML declaration with all parameter definitions using single quotes to wrap values:

Copy after login

The above is the detailed content of Detailed introduction to document and declaration usage in XML. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!