Home Backend Development XML/RSS Tutorial Detailed introduction to document and declaration usage in XML

Detailed introduction to document and declaration usage in XML

Mar 10, 2017 pm 07:59 PM
xml statement document

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:

<?xml version="1.0"?>
<contact-info>
    <name>Tanmay Patil</name>
    <company>TutorialsPoint</company>
    <phone>(011) 123-4567</phone>
</contact-info>
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:

<?xml
    version="version_number"
    encoding="encoding_declaration"
    standalone="standalone_status"
?>
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:

<?xml >
Copy after login

XML declaration with version definition:

XML/HTML CodeCopy content to clipboard Board

<?xml version="1.0">
Copy after login

XML declaration with all parameter definitions:

<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
Copy after login

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

<?xml version=&#39;1.0&#39; encoding=&#39;iso-8859-1&#39; standalone=&#39;no&#39; ?>
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!

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Insufficient memory or disk space to repagin or print this document Word error Insufficient memory or disk space to repagin or print this document Word error Feb 19, 2024 pm 07:15 PM

This article will introduce how to solve the problem of insufficient memory or disk space to repage or print the document in Microsoft Word. This error usually occurs when users try to print a Word document. If you encounter a similar error, please refer to the suggestions provided in this article to resolve it. Insufficient memory or disk space to repage or print this document Word error How to resolve the Microsoft Word printing error "There is not enough memory or disk space to repage or print the document." Update Microsoft Office Close memory-hogging applications Change your default printer Start Word in safe mode Rename the NorMal.dotm file Save the Word file as another

Can I open an XML file using PowerPoint? Can I open an XML file using PowerPoint? Feb 19, 2024 pm 09:06 PM

Can XML files be opened with PPT? XML, Extensible Markup Language (Extensible Markup Language), is a universal markup language that is widely used in data exchange and data storage. Compared with HTML, XML is more flexible and can define its own tags and data structures, making the storage and exchange of data more convenient and unified. PPT, or PowerPoint, is a software developed by Microsoft for creating presentations. It provides a comprehensive way of

How to add redline to Word document How to add redline to Word document Mar 01, 2024 am 09:40 AM

It is 395 words, which is 495. This article will show you how to add red lines in Word documents. Redlining a document refers to making modifications to the document so that users can clearly see the changes. This feature is very important when multiple people are editing a document together. What redline means Marking a document Redlining means using red lines or callouts to indicate changes, edits, or revisions to a document. The term was inspired by the practice of using a red pen to mark printed documents. Redline comments are widely used in different scenarios, such as clearly showing recommended changes to authors, editors, and reviewers when editing a document. Propose changes and modifications in legal agreements or contracts Provide constructive criticism and suggestions on papers, presentations, etc. How to give W

Can't open hyperlink in word document Can't open hyperlink in word document Feb 18, 2024 pm 06:10 PM

In recent years, with the continuous development of network technology, our lives are inseparable from various digital tools and the Internet. When processing documents, especially in writing, we often use word documents. However, sometimes we may encounter a difficult problem, that is, the hyperlink in the word document cannot be opened. This issue will be discussed below. First of all, we need to make it clear that hyperlinks refer to links added in word documents to other documents, web pages, directories, bookmarks, etc. When we click on these links, I

Word document is blank when opening on Windows 11/10 Word document is blank when opening on Windows 11/10 Mar 11, 2024 am 09:34 AM

When you encounter a blank page issue when opening a Word document on a Windows 11/10 computer, you may need to perform repairs to resolve the situation. There are various sources of this problem, one of the most common being a corrupted document itself. Furthermore, corruption of Office files may also lead to similar situations. Therefore, the fixes provided in this article may be helpful to you. You can try to use some tools to repair the damaged Word document, or try to convert the document to another format and reopen it. In addition, checking whether the Office software in the system needs to be updated is also a way to solve this problem. By following these simple steps, you may be able to fix Word document blank when opening Word document on Win

Learn the os.Stdout.Write function in the Go language documentation to implement standard output Learn the os.Stdout.Write function in the Go language documentation to implement standard output Nov 03, 2023 pm 03:48 PM

Learn the os.Stdout.Write function in the Go language documentation to implement standard output. In the Go language, standard output is implemented through os.Stdout. os.Stdout is a variable of type *os.File, which represents the standard output device. In order to output content to standard output, you can use the os.Stdout.Write function. This article will introduce how to use the os.Stdout.Write function to implement standard output and provide specific code examples. os.

How to handle XML and JSON data formats in C# development How to handle XML and JSON data formats in C# development Oct 09, 2023 pm 06:15 PM

How to handle XML and JSON data formats in C# development requires specific code examples. In modern software development, XML and JSON are two widely used data formats. XML (Extensible Markup Language) is a markup language used to store and transmit data, while JSON (JavaScript Object Notation) is a lightweight data exchange format. In C# development, we often need to process and operate XML and JSON data. This article will focus on how to use C# to process these two data formats, and attach

How to implement the basic usage of Workerman documents How to implement the basic usage of Workerman documents Nov 08, 2023 am 11:46 AM

Introduction to how to implement the basic usage of Workerman documents: Workerman is a high-performance PHP development framework that can help developers easily build high-concurrency network applications. This article will introduce the basic usage of Workerman, including installation and configuration, creating services and listening ports, handling client requests, etc. And give corresponding code examples. 1. Install and configure Workerman. Enter the following command on the command line to install Workerman: c

See all articles