Introduction to xml and xml tag elements in php

Source: Internet
Author: User
This article mainly introduces the basic introduction of xml and xml tag elements for getting started with php xml operations. The example analyzes the composition, specifications, and usage of XML, for more information about how to get started with xml in php, see the following example. Share it with you for your reference. The specific analysis is as follows:

The following describes how to use an xml instance:

 
  
    
   
    
Xiaoqiao
     
   
    
Female
   23 
   
    
   
    
Zhou Yu
     
   
    
Male
   27 
  
 

I. xml declaration:



(1) the xml declaration should be placed in the first line of the document;
(2) encoding: the character encoding of a document, such as UTF-8 and gb2312.
(3) standalone: The value is yes or no, which indicates whether the document definition is independent, that is, whether it is associated with other documents. The default value is no.

II. root element

Package in the outermost layer It is the root element. Each xml document must have only one root element.

III. xml elements, tags, and nodes

, , ,All are xml elements, also known as labels or nodes. Of course, the root element is also an element.
If the tag contains no content, as shown in figure Can be abbreviated . Even if it is written When the browser is opened, it is also displayed

4. spaces and line breaks in labels

Labels contain spaces and line breaks. xml documents treat spaces and line breaks as the original content. Therefore, pay special attention to programming.

V. xml label naming rules

(1) case sensitive;
(2) it cannot start with a number or;
(3) it cannot begin with xml, XML, Xml, or other special characters;
(4) it cannot contain spaces;
(5) cannot contain colons.

I hope this article will help you with the XML programming for php operations.

For more information about the basic introduction of xml and the xml tag element in php, see PHP!

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.