Character reference example:
<?xml version="1.0"?>
<chars>
<A1>®</A1>
<B1>©</B1>
<C1>¤</C1>
</chars>
Character references are parsed into actual characters when output. The result of the above content being displayed in the browser is:
<?xml version="1.0" ?>
- <chars>
<A1>®</A1>
<B1>©</B1>
<C1>¤</C1>
</chars>
Miscellaneous items include:
1. Processing instructions
It is an interface prepared by XML for other applications. Specifies an external application to process non-xml data in xml.
2. Comments
It is an illustrative text that can be ignored
3. Blank sign
Characters that cannot be displayed in spaces, carriage returns, line breaks, etc.
A well-formed xml file must do the following:
1. Documentation starts with an xml declaration
<?xml version="1.0"?>
This statement cannot have spaces or other characters before, that is, <?xml version="1.0"?> must be located in the first line and first column of the xml file, and must not contain spaces between <? and xml. Otherwise it is all wrong.
2. xml can only contain unique root elements
The correct example is as follows:
<?xml version="1.0"?>
<man>
<head>head</head>
<body>body</body>
</man>
An error example contains two root elements <head><body>.
<?xml version="1.0"?>
<head>head</head>
<body>body</body>
3. The mark must be closed
4. Empty mark agreement
Expression method: <empty mark/>
Empty tags can have attributes
5. Necessary nesting
Children elements must be nested within the parent element and cannot be intersected.
Elements of the same layer must be parallel to each other and cannot be nested with each other.
6. case sensitive
The start and end marks of the element must be consistent.
7. Properties settings
Quotes are required for setting properties.
8. How to represent special characters
References using predefined entity references:
Wrong writing method: <compare>3<6</compare>
Correct writing method: <compare>3<6</compare>
Previous page12Read the full text