XML Structure
〈?xml version= "1.0" encoding= "gb2312"?
Version is the revision number that identifies the standard used by this XML file; encoding indicates the type of character used in this XML file and can omit
XML parsing
The main function of the parser is to check the XML file for structural errors, peel off the markup in the XML file, and read the correct content to the next application processing.
Like HTML, in a browser, you must have a parser for the HTML so that the browser can "read" the various HTML markup pages and display them in front of us. If there is a tag that the browser's HTML parser cannot read, it will return the error message to us.
Because now the HTML markup is actually quite chaotic, there are a lot of nonstandard tags (some web pages with IE can display normally, and with Netscape Navigator is not), so from the beginning, the designer of XML strictly defined the syntax and structure of XML, The XML file We write must follow these rules, otherwise the XML parser will show you the error message mercilessly.
If an XML file satisfies some of the relevant laws in the XML specification and does not use a DTD (a file format definition, as detailed later), this file can be called well-formed. And if an XML file is well-formed, and the syntax used in DTD,DTD is correct, then this file is validating. corresponding to two XML files, there are two kinds of XML parser, one is well-formed parser and one is validating parser. The validating parser is included in IE 5, and the validating parser can be used to parse the well-formed XML file.
The markup in the XML file must be closed correctly, that is, in the XML file, the control tag must have a closing tag corresponding to it. such as: the "name" tag must have a corresponding 〈/name of the end tag, unlike HTML, the end tag of some tags is optional. If you encounter tags in an XML file that are self-contained in a single unit, which is similar to the 〈img src=.....〉 in HTML, the XML calls it an "empty element" and must be written like this: the empty element name/〉, if the element contains an attribute, the write rule is: empty element name Property name = "Property value"/〉.
The tags must not intersect. In the previous HTML file, you could write this:
〈b〉〈h〉xxxxxxx〈/b〉〈/h〉,〈b〉 and 〈h〉
There are overlapping areas between the tags, and in XML it is strictly forbidden to have such an interleaved notation, and the tags must appear in a regular order.
Attribute values must be enclosed in the "" number. As in the first example, "1.0", "gb2312", "RMB". They are all enclosed in "" and cannot be missed.
Control flags, directives, and attribute names are case-sensitive in English. Unlike HTML, in HTML, tags like 〈b〉 and 〈b〉 have the same meaning, whereas in XML, tags like 〈name〉, 〈name〉, or 〈name〉 are different.
XML Structure and syntax