Home  >  Article  >  Backend Development  >  Basic introduction to xml and xml tag elements for getting started with php operation xml_PHP tutorial

Basic introduction to xml and xml tag elements for getting started with php operation xml_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:09:07881browse

Basic introduction to xml and xml tag elements for getting started with php operation xml

Explained with xml examples:

The code is as follows:




Xiao Qiao
Female
23


Zhou Yu
Male
27


1. xml declaration:


(1). The xml statement should be placed on the first line of the document;
(2), encoding: document character encoding, such as utf-8, gb2312, etc.
(3) Standalone: ​​The value is yes or no, optional, indicating whether the document definition is independent, that is, whether it is related to other documents. The default is no.

2. Root element

The outermost is the root element. Each xml document must have and can only have one root element.

3. xml element/tag/node

, , , , etc. are all xml elements. Also called labels or nodes. Of course, the root element is also an element.
If there is no content in the tag, for example, there is no entity content between , it can be abbreviated as . Even if it is written as , when the browser is opened, it will still display

4. Spaces and line breaks in tags

For spaces and line breaks that appear in the

tag, the xml document will treat the spaces and line breaks as original content. So, pay special attention when programming.

5. Naming convention of xml tags

(1) Case sensitive;
(2) Cannot start with a number or "_";
(3) It cannot start with special characters such as xml, XML, or Xml;
(4) Cannot contain spaces;
(5) Cannot contain colon.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/947792.htmlTechArticleThe basic introduction of xml for getting started with php operation xml and the xml tag elements are explained with xml examples: The code is as follows: ?xml version =1.0 encoding=utf-8 standalone=no ? class student name Xiao Qiao/name sex female/s...
Statement:
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