The XML file ends with an. xml suffix name.
XML files need to be parsed using an XML parser. The browser has a built-in XML parser.
If XML does not specify encoding, then the browser is parsed by default with UTF-8 encoding
1. Label
Syntax: <student></student> start tag tag body content end Tag
Attention:
1) <student/> or <student></student> empty label. No tag body content
2) XML tag names are case-sensitive.
3) XML tags must be paired correctly.
4) cannot use spaces between XML tag names
5) XML tag name cannot start with a number
6) in an XML document, there is only one root tag
2. Properties
Syntax: <student name= "Eric" >student</Student>
Attention:
1) attribute values must be enclosed in quotation marks, cannot be omitted, and cannot be mixed with single and double quotes!!!
2) A tag can have multiple properties, but not duplicate property names!!!
3. Comments
Syntax:<!--XML Comment--
4. Document Declaration
Syntax: <?xml version= "1.0" encoding= "Utf-8"?>
Version number of the Version:xml
Encoding: Code table to query when parsing XML file (code table when decoding process)
Attention:
1) If the XML file is developed in the Ecplise tool, the file is saved automatically according to the encoding of the document declaration when the XML file is saved.
2) If you modify the XML file with the Notepad tool, keep in mind that the XML file is saved according to the Encoding Code table declared by the document.
5. Escape character
Some special characters are built into the XML, and these special characters cannot be exported directly from the browser. If you want to export these special characters to the browser as they are, escape these special characters. The character after escaping is called an escape byte.
Escape character
Special Characters |
Escape Character |
< |
< |
> |
> |
" |
" |
& |
& |
Space |
&nsbp; |
6. CDATA Zone
Function: You can have some content that requires special characters to be uniformly output as-is.
7. Processing instructions
Role: Telling XML parsing if parsing an XML document
XML sequence: (1) XML syntax