Home>Article>Backend Development> An article takes you into XML syntax rules

An article takes you into XML syntax rules

王林
王林 forward
2019-08-26 13:48:16 5229browse

1. All XML elements must have closing tags

In HTML, you often see elements without closing tags:

This is a paragraph

This is another paragraph

In XML, It is illegal to omit the closing tag. All elements must have closing tags:

This is a paragraph

This is another paragraph

2. XML tags are case-sensitive

XML elements are defined using XML tags.

XML tags are case-sensitive. In XML, the tag is different from the tag .

Opening and closing tags must be written using the same case.

3. XML must be nested correctly

In HTML, you often see elements that are not nested correctly.

This text is bold and italic

In XML, all elements must be correctly nested within each other:

This text is bold and italic

Correct nesting means: since theelement is opened within theelement , then it must be closed within theelement.

4. The XML document must have a root element

The XML document must have one element that is the parent element of all other elements. This element is called the root element.

  ....  

5. XML attribute values must be quoted

 

An article takes you into XML syntax rules

Note: Only "" is legal, but it's a good practice to use an entity reference instead.

6. In XML, spaces will be preserved.

7. XML stores line breaks in LF

In window applications, line breaks are usually stored as one character: carriage return (CR) and Line feed (LF). This pair of characters has similarities to the action of a typewriter setting a new line. In Unix applications, new lines are stored as LF characters. Macintosh applications use CR to store new lines.

8. Summary:

All XML elements must have closing tags, opening tags and closing tags must be written in the same case, and must be nested correctly , there must be a root element, XML attribute values must be quoted, etc. The syntax rules of XML are simple and logical. These rules are easy to learn and easy to use.

If you want to learn more related content, please visit the PHP Chinese website:XML video tutorial

The above is the detailed content of An article takes you into XML syntax rules. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:csdn.net. If there is any infringement, please contact admin@php.cn delete