XML Easy Learning Handbook (2) XML concepts

Source: Internet
Author: User
Tags define object definition functions implement object model window xsl
xml| concept

Chapter II XML Concepts

Introduction

With the quick start of the first chapter, you've learned that XML is a language that lets you create identities, separating data from Web pages, storing data and sharing data with the ability to make XML omnipotent. If you want to learn XML in depth, and the system grasps the ins and outs of XML, we first have to go back to the problem of XML concepts. XML (extensible Markup Language), an extensibility identifier language. "Extensibility" identifies "language." Each word clearly identifies the important features and functions of XML. Let's analyze This carefully:

I. Extensibility
Two. Logo
Three. Language
Four. Structured
Five. Meta-data
Six. Show
Seven. DOM

I. Extensibility---Using XML, you can create your own tags (tags) for your documents.

The first word in XML is "extensibility," which is why XML is powerful and resilient.
In HTML, there are a lot of fixed tags that we have to remember and then use, and you can't use tags that are not in the HTML specification. And in XML, you can create any tag you need. You can give full play to your imagination by giving your document some nice tag names. For example, your document contains some introduction to the game, you can create a tag named <game>, and then in <game> under the game category to build <RPG>,<SLG> and other tags. As long as it's clear and easy to understand you can build any number of markers.

You might not get used to it at first, because we are learning HTML, there are fixed tags can be directly learned and used; (a lot of people, including myself, are analyzing other people's code and logo, creating their own web pages), while XML has no tags to learn, and very few documents are the same tags. What are we going to do? Oh, did not create on their own AH. Once you actually start writing XML documents, you'll find it interesting to create new tags at will. You can build your own markup and even build your own HTML language.

Extensibility allows you to have more choices and powerful abilities, but it also creates the problem that you have to learn to plan. You have to understand your own documents, know what parts it consists of, how they relate to each other, and how to identify them.

It also needs to be explained that the identification is a type or feature that describes the data, such as &LT;WIDTH&GT, age <age&gt, name <name> etc, not the content of the data, such as:<10pxl>,<18> ,< John, these are useless tags. If you have studied a database, you can understand that identity is a field name.

Two. Identification---Using XML you can identify the elements in the document.

The second word in XML is "identity," which indicates that the purpose of XML is to identify elements in a document.

Whether you are HTML or XML, the nature of the logo is easy to understand, if there is no identification, your document on the computer is just a very long string, each word looks the same, there is no emphasis on the points.

By marking, your document is easy to read and understand, you can divide the paragraphs and list the headings. In XML, you can use extensibility to create a more appropriate identity for your document.

However, it is important to note that the identity is only used to identify information, and it does not convey information itself. For example, this HTML code:

<b>frist step<b>
Here <b> represents bold, only to show that the "frist step" character is shown in bold,<b> itself does not contain any actual information, you do not see the <b&gt on the page, and the message is "frist step".

Three. Language---Using XML you have to follow a specific syntax to identify your document.

The third word in XML is "language". This shows that XML as a language must follow certain rules. Although XML extensibility allows you to create new identities, it must still follow a specific structure, syntax, and explicit definition.

In the computer field, language often denotes a quot program language, which is used to programmatically implement functions and applications, but not all languages are programmed, and XML is just a language used to define identity and descriptive information.

Let's take a closer look at the XML application of this principle, may be very boring, but for the overall understanding is very important, you can go through it quickly, the mind has a vague concept, the specific essence of the need to slowly grasp in practice.

Four. Structured---XML makes the document structured, and all information is arranged in a relational way.

"Structured" sounds too abstract, as we understand it, structured to create a framework for your document, like writing an outline to write an article. Structured so that your document does not look cluttered, each part is closely linked to form a whole.

There are two principles of structure:
1. Each part (each element) is associated with other elements. The associated series forms a structure.
2. The meaning of the identity itself is separated from the information it describes.

Let's look at a simple example to help understand:
<?xml version= "1.0" encoding= "GB2312"?>
<myfile>
<title>xml Easy Learning Handbook </title>
<chapter>xml Quick Start
<para> What is xml</para>
<para> benefits of using XML </para>
</chapter>
The concept of <chapter>xml
<para> Extensibility </para>
<para> logo </para>
</chapter>
</myfile>
This is the XML description document for this article, and you can see that the logo is three-level associated, very clear:
<myfile>
<chapter>
<para>
...
</para>
</chapter>
</myfile>
The document structure above, which we call the "document Tree", is the parent element, such as &LT;MYFILE&GT, and the branches and pages are child elements such as <chapter> and <para>.

Five. Meta data (METADATA)---Professional XML users work with meta data.

In HTML we know that you can use META tags to define keywords for Web pages, profiles, etc., which are not displayed in the Web page, but can be searched by search engines and affect the order in which search results are sorted.

XML deepens and expands on this principle, in XML, where you can describe your information, you can validate information through meta, perform a search, force a display, or process other data.

Here are some of the uses of XML metadata in practical applications:

1. Digital signatures can be validated to make the online Business submission action (submission) effective.
2. Can be easily indexed and more efficient search.
3. Data can be transmitted between different languages.

The consortium is working on a metadata approach called RDF (Resource Description Framework) that automatically exchanges information, and the consortium claims that using RDF in conjunction with digital signatures will allow for "authentic" e-business in the network.

Six. Show

XML cannot display pages alone, and we use formatting techniques, such as CSS or XSL, to display documents created by XML tags.

In the first chapter we talked about XML as separating data from format. The XML document itself does not know how to display, and must have a secondary file to help implement it. (XML cancels all identities, including style definition identities such as font,color,p, so XML is all about using a method like DHTML CSS to define document style styles.) ), the file types used in XML to set display style styles are:

1.XSL

The XSL full name is the extensible Stylesheet Language (Extensible Style language), the primary file type for future design of XML document display styles. It is also based on the XML language itself. With XSL, you can flexibly set the document display style, and the document will automatically adapt to any browser and PDA (palmtop).

XSL can also convert XML to HTML, so older browsers can also browse XML documents.

2.CSS

CSS is familiar, the full name is cascading style Sheets (cascading style sheet), is currently used to display XML documents on the browser the Main method.

3.Behaviors

Behaviors has not become a standard yet. It is a unique feature of Microsoft's IE browser, with which you can set some interesting actions on the XML identity.

Seven. DOM

Dom is the Document Object model, what is DOM used for? If you think of your document as a separate object, Dom is the standard for manipulating and controlling the object in HTML or XML.

Object-oriented methods of thinking have been very popular, in programming languages (such as JAVA,JS), the use of object-oriented programming ideas. In XML, to manipulate and control a Web page as an object, we can build our own objects and templates. The API is used to communicate with objects and to command objects. The API full name application programming Interface, which is the rule for accessing and manipulating objects. Dom is an API that describes the rules of Html/xml document objects in detail. It prescribes the naming conventions, program models, and communication rules for Html/xml document objects. In an XML document, we can treat each identity element as an object---it has its own name and attributes.

XML creates identities, and Dom's role is to tell the script how to manipulate and display these identities in a browser window

Here we have a brief overview of some of the fundamentals of XML, and let's look at how they relate to each other and how they work, first look at a picture here:



1.XML describes the data type. For example: "King Lear" is a headline element;
2.CSS stores and controls the display style of the element. For example: The title will be displayed in 18pt font
The 3.script script controls how the element acts. For example: When a TITLE element "out of the stock" is displayed in red.
4.DOM provides a common platform for the exchange of scripts and objects, and displays the results in a browser window.

If any part of the error occurs, it will not get the correct result.

Well, seeing here, we've got a general idea of how XML works. Through this chapter of study, we may feel that XML seems to be more biased data processing, more convenient for programmers to learn. In fact, the purpose of XML design is to facilitate the sharing and interaction of data. In the next chapter, we will systematically learn about the various terms of XML. You are welcome to continue browsing.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.