B/S: XML learning summary; s: xml Summary
XML
Extensible Markup Language, a subset of Standard Generic Markup languages, is a markup language used to mark electronic files to make them structured.
In recent years, as Web applications become more and more widely used, people gradually feel that HTML is not enough, and the syntax of HTML is too simple, which seriously hinders the use of HTML to express complex forms. Although HTML has released a new version, it already has expressions such as scripts, tables, and frames, but it still cannot meet the increasing demand.
Some people suggest using SGML directly as the Web language, which can solve the difficulties encountered by HTML. However, SGML is too large for users to learn and use it easily. It is very difficult to fully implement the SGML browser, so they naturally think of using only the subset of SGML, make the new language easy to use and implement. In this situation, the W3C of the Web Standardization Organization recommends that you use a simplified SGML version-XML.
[Figure 1] XML family history
Q1: What is XML?
- XML refers to the EXtensible Markup Language (EXtensible Markup Language)
- XML is a markup language, similar to HTML
- XML is designed to transmit data rather than display data. It is often used to simplify data storage and sharing.
- The XML tag is not predefined. You need to customize the tag.
- XML is designed to be self-descriptive.
- One of the advantages of XML is that it can be expanded without interrupting applications.
Q2: What is the difference between XML and HTML?
- XML is designed to transmit and store data.
- HTML is designed to display data.
- XML is not an alternative to HTML.
- XML and HTML are designed for different purposes:
- XML is designed to transmit and store data, with the focus on data content.
- HTML is designed to display data. Its focus is on the appearance of the data.
- XML separates data from HTML. XML documents form a tree structure that begins with "root" and expands to "branches ".
Xml dtd and XML Schema
The roles of the two are easy to understand. In order to exchange data correctly, we need to specify the Data Type of the document, that is, the structure of the document. Here, for example, Italians speak Italian and Japanese speak Japanese. Two businessmen must have a unified language to conduct foreign trade, that is, the general principles of trade, Incoterm2010 (as an international trade student, I can associate computer science with professional courses. It can be seen that my professional courses are always running slowly ~) Imagine that an XML is composed of elements, attributes, and content. Then, the DTD or its upgraded Schema is used to specify when and where an XML document may appear, each element can have any descriptive attribute. And the order in which they appear, the number of repetitions. Both have detailed provisions.
DTD can be embedded in an XML document, or a separate file can be formed and imported.
<?xml version="1.0"encoding="UTF-8"? > <!DOCTYPE note [ <!ELEMENT note (to,from,heading,body)> <!ELEMENT to (#PCDATA)> <!ELEMENT from (#PCDATA)> <!ELEMENT heading (#PCDATA)> <!ELEMENT body (#PCDATA)> ]> <to>George</to><from>John</from>
Q1: Relationship between DTD and Schema
- Are used to describe the structure of the XML document.
- Schema is a substitute for XML-based DTD.
- Schema is more powerful than DTD.
Q2: Advantages of Schema
- XML Schema supports data types
- XML Schema uses XML syntax
The advantage is that you do not have to learn new languages. You can use the XML editor to edit and parse Schema files.
- XML Schema protects Data Communication
Through Schema, the sender can use a method that the receiver can understand to describe the data.
You can customize the data types you need based on the original data types. Multiple schemas can be referenced in the same document.
Conclusion: through the study of XML, we know that HTML and XML are not necessarily related, and they are always confused by different purposes. After learning about the composition of XML, the next step is to learn the JavaScript script language and how to operate XML files in JS.