Home > php教程 > php手册 > body text

php操作xml入门之xml基本介绍及xml标签元素

WBOY
Release: 2016-06-13 09:16:28
Original
1046 people have browsed it

php操作xml入门之xml基本介绍及xml标签元素

 以xml实例来讲解:

代码如下:




小乔

23


周瑜

27


一、xml声明:

 


(1)、xml声明要放在文档的第一行;
(2)、encoding:文档字符编码,如utf-8、gb2312等。
(3)、standalone:值为yes或者no,可有可无,表示文档定义是否独立,即与其它文档是否有关联。默认为no。

二、根元素

包在最外层的为根元素,每个 xml 文档都必须有且只能有一个根元素。

三、xml 元素/标签/节点

等都是xml的元素,元素也称为标签或节点。当然,根元素也是一元素。
如果标签中没有内容,如之间没有实体内容,则可以简写为。即使是写成,浏览器打开时,也是显示

四、标签中的空格与换行

标签中出现的空格与换行,xml 文档会将空格与换行当作原始内容来处理。所以,在编程时要特别注意。

五、xml标签的命名规范

(1)区分大小写;
(2)不能以数字或“_”开头;
(3)不能以 xml、XML、Xml等特殊字符开头;
(4)不能包含空格;
(5)不能包含冒号。

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 Recommendations
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!