In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-08 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly shows you "how to use an example to learn XML syntax", the content is simple and easy to understand, organized clearly, I hope to help you solve doubts, let Xiaobian lead you to study and learn "how to use an example to learn XML syntax" this article bar.
XML syntax rules are both simple and strict. These rules are easy to learn and easy to use. Because of this, creating software that can read and manipulate XML is not difficult. An example of an XML document XML uses a simple syntax that describes itself.
XML syntax rules are both simple and strict. These rules are easy to learn and easy to use.
Because of this, creating software that can read and manipulate XML is not difficult. An example of an XML document
XML uses a simple syntax that describes 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 (as if saying,"This document is a note"):
The next four lines describe the four children 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:
As you can see, this XML document contains a note left by Jani for Tove. By now, you should agree with us that XML is perfectly self-describing. All elements must have close tags
When using XML, it is illegal to omit close tags.
In HTML, certain elements do not have to have closing tags. The following code is legal in HTML:
This is a paragraph
This is another paragraph
In XML, all elements must have closing tags:
This is a paragraph
This is another paragraph
Note: You may have noticed from the example above that XML declarations do not have closing tags. It's not a mistake. Declarations are not part of XML itself. It is not an XML element and does not require closing tags. XML tags are case sensitive
Unlike HTML, XML tags are case sensitive.
In XML, tags and tags are different.
So you have to use the same case to open and close labels:
This is wrong. That's right. XML must be nested correctly
Incorrect tag nesting is meaningless to XML.
In HTML, certain elements can be incorrectly nested within each other, like this:
This text is bold and italic
In XML, all elements must be nested correctly within each other, like this:
This text is bold and italic XML documents must have root elements
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 children. Child elements must be correctly nested within their parent elements:
..... XML attribute values must be enclosed in quotes
In XML, it is illegal to omit quotation marks around attribute values.
Like HTML, XML can have attributes (name/value pairs). In XML, attribute values of XML must be enclosed in quotes. Consider the following two XML documents. The first is wrong, the second is correct:
ToveJaniToveJani
In the first document, the date attribute is not quoted. This is correct: date="12/11/2002". This is incorrect: date=12/11/2002. In XML, spaces are preserved.
In XML, spaces are not truncated.
This is different from HTML. In HTML, a sentence like this:
Hello my name is Tove,
It will look like this:
Hello my name is Tove,
This is because HTML reduces several consecutive white space characters to one. CR / LF is converted to LF in XML
In XML, a new line (i.e., newline) is stored as LF (Line Feed).
Are you familiar with typewriters? Typewriters are mechanical devices used in the last century to make printed documents.:-)
When you type a line of text on the typewriter, you manually move the carriage to the left margin and manually feed the line.
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 on a typewriter. In Unix applications, new lines are usually stored as LF characters. Macintosh applications use CR characters only to store new lines. Comments in XML
The syntax for writing comments in XML is similar to HTML:
XML is nothing special.
XML is nothing special. It's just plain text with tags enclosed in brackets.
Software that can process plain text files can also process XML. XML tags can also be displayed in a simple text editor without special treatment.
In XML-aware applications, XML tags are handled exclusively. Depending on the type of application, these tags may/may not be visible, or they may have some functional significance.
That's all for "How to learn XML syntax with an example." Thanks for reading! I believe that everyone has a certain understanding, hope to share the content to help everyone, if you still want to learn more knowledge, welcome to pay attention to 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