The XML element is scalable, and there is associated between them.
XML elements have a simple naming rule.
XML elements are scalable
XML documents can be extended while carrying more information.
Please see the XML notebook below:
Note>
Let's imagine software that can read this XML document and can interpret the software of the XML element (
Message to: linfrom: Ordmdon't forget me this weekend!
Let's envision, if the author of the note is added to this XML document, as shown below:
Note>
So is the original application interrupt or collapse?
will not. The application will still interpret the
XML documentation can be expanded!
XML elements are interrelated
The relationship between the XML element is a parent element and a child element.
In order to better understand the XML terminology, you must understand how the relationship between XML elements, and how the elements are described.
Imagine such a book:
Signature: XML Guide Chapter 1: XML Getting Started Introduction
What is HTML What is XML Chapter 2: XML Syntax
XML elements must have end tags XML elements must be properly nested
We can use XML documents to describe this book:
chapter>
chapter>
book>
In the above code, the BOOK element is the root element of the XML document, the title element and the Chapter element are the child elements of the BOOK element. Book elements are the parent element of the Title element and the chapter element. Title elements, PROD elements and chapter elements are flat-level elements because they have the same parent element.
XML element content
XML elements have different content.
The XML element refers to this part of the content between the beginning of the end marker from the beginning of the element.
XML elements have element content, mixed content, simple content or empty content. Each element can have its own properties.
In the above example, the BOOK element has an element content, and the BOOK element should contain other elements. The Chapter element has a mixed content because it contains text and other elements. The PARA element has a simple content because there is only a simple text. The PROD element is empty because he does not carry any information. In the above example, only the PROD element has attributes, the id attribute value is 33-657, and the MedIA property value is Paper.
XML element name
XML element naming must abide by the following rules:
The name of the element can contain a child, numbers, and other characters. The name of the element cannot be started with a number or punctuation. The name of the element cannot be started at XML (or XML, XML, XML ...). The name of the element cannot contain spaces.
The XML element of "invent" must also pay attention to some simple rules:
Any name can be used, no reserved word (except XML), but should make the name of the element be readable, the name is useful to use the underscore is a nice choice.
For example:
Try to avoid using "-", "." Because it is possible to cause confusion.
As long as you like the name of the elements can be very long, don't be too exaggerated. Naming should follow the principle of simple and easy-to-read, for example:
XML documents often correspond to the data sheet, we should try to make the name of the field in the database and the naming in the corresponding XML document, so that it can be easily data transform.
Non-English / characters / strings can also be used as the name of the XML element, such as
Do not use ":" in the XML element name, because XML namespace needs to be used in this very special character.