Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the XML syntax?

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "what is XML Grammar". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn what XML Grammar has.

Yufuzi

Man

twenty-seven

I am a good man!

An XML document consists of an XML declaration and a root element or tag that contains some nested elements.

1. The purpose of the declaration statement is to tell the browser or other processor that the document is an XML document. A declaration must be included at the beginning of each XML document. The version in the declaration statement indicates the version of the XML specification that the document conforms to. Encoding represents the language encoding used in the document, and this example uses the "ISO-8859-1" Western European character set.

The 2.XML element refers to the part of the content from the beginning tag to the end tag of the element. For example, yufuzi is called an element. The naming of the XML element must follow the following rules:

The name of an element can contain child letters, numbers, and other characters.

The name of an element cannot start with a number or punctuation.

Element name cannot be XML (or xml,Xml,xMl...) The beginning.

The name of the element cannot contain spaces.

Do not use ":" in XML element naming.

Every element must have a closing tag. In an HTML document, some elements can have no closing tag, such as:

This is a text.

Hello world!

This is a perfectly legal HTML document, but in an XML document it must be written as:

This is a text.

Hello world!

Note that in the XML document

It's not the same as the paragraph tag in HTML, it's just your custom tag, you can give it any meaning you want.

XML tags are case sensitive, for example, and are two different tags:

Yufuzi// error

Yufuzi// is correct

XML elements have element content, mixed content, simple content, or empty content. Each element can have its own attributes. Name elements only contain text content "yufuzi". In fact, elements can contain not only text content, but also other elements, which is called element nesting. Tags in HTML documents can be cross-nested, but can only contain nesting in XML documents, such as:

This text is emphasized and italic. The previous code in the HTML document can be parsed by the browser, but only include nesting in the XML document, which can be written like the following code:

This text is emphasized and italic.

Example:

Happy old man

Cnbruce

Male

He is a terrible guy!

I am a person who likes to build his happiness on the sufferings of others: -)

Yufuzi

Male

He is an excellent man!

In the above code, the club element is the root element of the XML document, and there must be and only one root element in each XML document, name element, record number element, member element is a sibling element, they are all children of the root element, the name element is an element containing only text content, the record number element is an empty element containing attributes, and the second member element contains not only text information. It also contains other elements.

All XML documents must have a root element. All XML elements must have a closing tag. Tags are case sensitive. All XML elements must be properly nested. Attributes must be included in the opening tag with quotation marks on both sides

Thank you for your reading, the above is the content of "what does XML Grammar have". After the study of this article, I believe you have a deeper understanding of what XML Grammar has, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report