May 31, 2021 Article blog
XML is a software and hardware-independent information transfer tool. X ML is the recommended standard for W3C. XML is ubiquitous, and when we see the rapid pace of development of the XML standard, and the large number of software developers taking it at a rapid pace, it's really amazing.
Today, XML is no less effective in the Web than HTML, which has always been the cornerstone of the Web. X ML is the most frequently used tool for data transfer between programs and is becoming increasingly popular in the field of information storage and description. To learn XML, you can use the XML.DOM tutorial
XML (expandable markup language), a subset of standard universal markup languages, is a markup language used to mark electronic files to make them structural. In an electronic computer, a marker is an information symbol that a computer can understand, and by doing so, a computer can process information that includes a variety of information, such as articles.
It can be used to tag data, define data types, and is a source language that allows users to define their own markup language. I t is ideal for World Wide Web transmission, providing a unified way to describe and exchange structured data independently of the utilizing program or vendor. i s a cross-platform, content-dependent technology in an Internet environment and an effective tool for dealing with distributed structured information today. As early as 1998, W3C released the XML 1.0 specification, which is used to simplify the transfer of document information over the Internet.
XML is inaction. I t may be a little hard to understand, but XML doesn't do anything. XML is designed to structure, store, and transfer interest.
Let's give you a simple example of what we've written in a note book.
Here is a list of books stored as XML:
<?xml version="1.0" encoding="gb2312"?>
<Book List>
<Computer Book>
<bookname>XML利用大全</bookname>
<price>39.00</price>
</ Computer Books>
<Computer Book>
<bookname>Java利用大全</bookname>
<price>139.00</price>
</ Computer Books>
<Computer Book>
<bookname>Oracle利用大全</bookname>
<price>59.00</price>
</ Computer Books>
</ Book list>
The note above is self-descriptive. I t has a title and message, and includes information about the sender and recipient. H owever, this XML document still does nothing. I t is simply information wrapped in XML labels. We need to write software or programs to transmit, receive, and display this document.
XML is nothing special. I t's just plain text. S oftware that has the ability to handle plain text can handle XML. H owever, applications that can read XML can target XML labels. T he functional significance of labels depends on the characteristics of the utilizing program. We'll see what XML tags do in future content.
The labels in the example above are not defined in any XML standard (e.g. and <price >, etc.). T hese labels were invented by the author of the document. T his is because XML does not have a predefined label. XML allows authors to define their own labels and their own document structures.
The labels (and the structure of HTML) used in HTML are predefined. HTML documents use only labels defined in HTML standards (such as < p>, < h1>, and so on).
As we can see in the book example above, XML documents form a tree structure that starts at the root and then expands to "branches and leaves."
An instance of an XML document
XML uses simple, self-descriptive syntax:
<?xml version="1.0" encoding="UTF⑻"?>
<note>
<to>George</to>
<from>John</from>
<heading>Reminder</heading>
<body>Don't forget the meeting!</body>
</note>
The first line is the XML declaration. I
t defines the version of XML (1.0) and the encoding used (UTF-8, GBK, etc.);
The next line describes the root elements of the document (like, "This document is a note"): <note >;
The next four lines describe the four child elements of the root (to, from, heading, and body):
<to>George</to>
<from>John</from>
<heading>Reminder</heading>
<body>Don't forget the meeting!</body>;
The last line defines the end of the root element: </note >.
As you can imagine from this example, the XML document includes a note john gave George.
XML is excellent for self-description, do you agree?
XML documents form a tree structure
The XML document must include the root element. The element is the parent of all other elements.
Elements in an XML document make up a document tree. The tree starts at the root and expands to the bottom of the tree.
All elements can have child elements:
<root> <child> <subchild>.....</subchild> </child> </root>
Terms such as parent, child, and sibling are used to describe the relationship between elements. T he parent element has child elements. C hild elements at the same level become siblings (brothers or sisters). All elements can have text content and properties (similar to in HTML).
instance:
The image above represents a book in the following XML:
<bookstore>
<book category="COOKING">
<title >Everyday Italian</title>
<author>Giada De Laurentiis</author>
<year>2005</year>
<price>30.00</price>
</book>
<book category="CHILDREN">
<title >Harry Potter</title>
<author>J K. Rowling</author>
<year>2005</year>
<price>29.99</price>
</book>
<book category="WEB">
<title >Learning XML</title>
<author>Erik T. Ray</author>
<year>2003</year>
<price>39.95</price>
</book>
</bookstore>
The root element in the example is < bookstore >. A ll < book > elements in the document are included in the < bookstore >. <book > elements have four child elements:
<title>、< author>、<year>、<price>。
XML is often used to simplify the storage and sharing of data
If you need to display dynamic data in an HTML document, you'll spend a lot of time editing HTML whenever the data changes. X ML enables data to be stored in separate XML files. T his allows you to focus on laying out and displaying html and making sure that modifying the underlying data eliminates any need to make any changes to HTML. By using a few lines of JavaScript, you can read an external XML file and then update the contents of the data in HTML.
In the real world, computer systems and data are stored in incompatible formats. X ML data is stored in plain text, providing a software- and hardware-independent data storage method. This makes it easier to create data that different users can share.
XML makes it easy to exchange data between incompatible systems. O ne of the most time-consuming challenges for developers has been the exchange of data between incompatible systems on the Internet. Because data can be read through a variety of incompatible exploits, the complexity of exchanging data in XML reduces this complexity.
Upgrading to a new system (hardware or software platform) is always time-consuming. L arge amounts of data must be converted, and incompatible data is often lost. X ML data is stored in text format. This makes it easier for XML to expand or upgrade to a new operating system, new exploits, or new browser without losing data.
Because XML is independent of hardware, software, and leverage programs, XML makes your data more available and useful. D ifferent consumers have access to your data, not just on HTML pages, but also from XML data sources. XML makes your data available for a variety of browsing devices (handheld computers, voice devices, news browsers, etc.) and for the blind or other disabled.
Many new Internet languages are created through XML, including:
You can also practice and master it with XML instances
and XML quiz to assess your learning status