In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
In this article, the editor introduces in detail the "XML Grammar case Analysis", with detailed content, clear steps and proper handling of details. I hope this "XML Grammar case Analysis" article can help you solve your doubts.
The grammar rules of XML are both simple and strict. These rules are easy to learn and easy to use.
Because of this, it is not difficult to create software that can read and operate XML. An example of an XML document
XML uses a simple syntax that can be described by itself.
ToveJaniReminderDon't forget me this weekend!
The first line in this document-the XML declaration-defines the version of XML and the character encoding used in the document. In this example, the XML 1.0 specification is followed and the ISO-8859-1 character set is used.
The next line describes the root element of the document (like saying, "this document is a note"):
The next four lines describe the four child elements of the root element (to, from, heading, and body):
ToveJaniReminderDon't forget me this weekend!
The last line defines the end of the root element:
We can see that this XML document contains a note left to Tove by Jani. Now, you should agree with us that XML has perfect self-description characteristics. All elements must be related to closed tags
When using XML, it is illegal to omit the closing tag.
In HTML, some elements do not have to have a close tag. The following code is legal in HTML:
This is a paragraph
This is another paragraph
In XML, all elements must have a close tag:
This is a paragraph
This is another paragraph
Note: you may have noticed from the above example that the XML declaration does not close the tag. It's not a mistake. The declaration is not part of XML itself. It is not a XML element, nor does it need to close the tag. XML tags are case sensitive
Unlike HTML, XML tags are case-sensitive.
In XML, tags and tags are different.
So you must open and close the label using the same case:
This is wrong. This is correct. XML must be properly nested
Incorrect nesting of tags makes no sense to XML.
In HTML, some elements can be incorrectly nested within each other, like this:
This text is bold and italic
In XML, all elements must be correctly nested within each other, like this:
The This text is bold and italicXML document must have a root element
All XML must contain a single tag pair that defines the root element.
All other elements must be inside this root element.
All elements can have child elements. Child elements must be correctly nested inside their parent elements:
. Attribute values of XML must be in quotation marks
In XML, it is illegal to omit quotation marks around attribute values.
Like HTML, XML can also have attributes (name / value pairs). In XML, the attribute value of XML must be in quotation marks. Please study the following two XML documents. The first is wrong and the second is right:
ToveJani
ToveJani
In the first document, the date attribute is not quoted. This is correct: date= "12 Universe 11 Universe 2002". This is wrong: date=12/11/2002. In XML, spaces are retained.
In XML, spaces are not truncated.
This is different from HTML. In HTML, a sentence like this:
Hello my name is Tove
It will appear as follows:
Hello my name is Tove
This is because HTML reduces multiple consecutive space characters to one. In XML, CR / LF is converted to LF
In XML, a new line (or newline) is stored as LF (Line Feed, newline).
Are you familiar with typewriters? Typewriters are mechanical equipment used to make printed documents in the last century. : -)
When you have typed a line of text on your typewriter, you need to manually move the print slider to the left margin and feed the line manually.
In Windows applications, new lines are usually stored as a pair of characters: carriage return (CR) and line feed (LF). This character pair is similar to the action of setting a new line in a typewriter. In Unix applications, new lines are usually stored as LF characters. Macintosh applications use only CR characters to store new lines. Comments in XML
The syntax for writing comments in XML is similar to the syntax for HTML:
There is nothing special about XML
There is nothing special about XML. It's just plain text with tags enclosed in angle brackets.
Software that can handle plain text files can also handle XML. In a simple text editor, XML tags can also be displayed without special treatment.
In XML-aware (XML-aware) applications, XML tags are processed specifically. Depending on the type of application, these tags may / may not be seen, or may have some functional meaning.
After reading this, the article "XML Grammar case Analysis" has been introduced. If you want to master the knowledge points of this article, you still need to practice and use it yourself to understand it. If you want to know more about related articles, welcome to follow the industry information channel.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.