An overview of XML learning 1:xml

Source: Internet
Author: User

Already knew the XML, unfortunately has not been the systematic study, this time touches the Java file transfer, also uses the XML, therefore learns to study.

an XML preamble

The best description of XML

XML is an information transfer tool that is independent of software and hardware. XML is the recommended standard for the consortium. XML everywhere, when we see the XML standard flying violently

Into the development progress, as well as a large number of software developers to adopt this standard of the ever-changing speed, really can't help but sigh this is really breathtaking.

Currently, the role of XML in the Web does not renmin the HTML that has always been the cornerstone of the Web. XML is a data transfer between various applications.

Most commonly used tools, and are becoming more and more popular in the area of information storage and characterization.

two basic XML Overview

XML (Extensible Markup Language), a subset of standard generic markup languages, is a markup language that is used to mark electronic files as structured. In the electrical

Child Calculation machine, the mark refers to the information symbols that the computer can understand, through which tags, the computer can handle a variety of information, such as articles.

it can be used to tag data, define data type, which is a source language that allows users to define their own markup language. It is ideal for the World Wide Web

lose, provide a unified approach to describing and exchanging structured data that is independent of the application or vendor. is a cross-platform, content-dependent in the Internet environment

Technology surgery, but also is the effective way to deal with distributed structure information today tools. As early as 1998, the XML1.0 specification was released, using it to simplify the Internet

text File Letter Interest transmission.

Three What is XML?

(1) XML refers to Extensible Markup Language (extensible Markup Language).

(2) XML is a markup language, much like HTML (Hypertext Markup Language).

(3) XML is designed to transmit data rather than display it.

(4) XML tags are not predefined. You need to define your own labels.

(5) XML is designed to be self-descriptive.

(6) XML is the recommended standard for the consortium.

Four main differences between XML and HTML

(1) XML and HTML are designed for different purposes.

(2) XML is designed to transmit and store data, with the focus on the content of the data.

(3) HTML is designed to display data with the focus on the appearance of the data.

(4) HTML is designed to display information, while XML is designed to transmit information.

(5) XML is not an alternative to HTML, and XML is a complement to HTML.

(6) It is important to understand that XML does not replace HTML. In most Web applications, XML is used to transfer data, and HTML is used for formatting

and display the data.

(7) XML is designed to transmit and store data. And HTML is designed to display data.

Five Why XML is required

(1) Solve the problem of non-standard data transmission.

(2) a tree-shaped structure can be very well described.

(3) can be used as a configuration file.

six XML without any behavior

XML is not a function of. Maybe it's a little hard to understand, but XML doesn't do anything. XML is designed to structure, store, and transmit interest.

Let's give a simple example of writing in Notepad to illustrate this.

Here is a list of books, stored as XML:

<?xml version= "1.0" encoding= "gb2312"?>< Books list >         < computer books >      <bookname>xml applications </ bookname>      <price>39.00</price> </Computer Books > < computer books >      <bookname>java application Daquan </ bookname>      <price>139.00</price> </Computer Books > < computer books >      <bookname>oracle application Daquan </bookname>      <price>59.00</price> </Computer Books ></book list >

The note above has a self-descriptive nature. It has a title as well as a message and contains information about the sender and the recipient. However, this XML text

The document still does not do anything. It's just pure information wrapped in an XML tag. We need to write software or programs to transmit, receive, and

Show this document.

Seven XML is just plain text

XML is nothing special. It's just plain text. Software that has the ability to handle plain text can handle XML. However, the ability to read and understand XML should be

A program can handle XML tags in a targeted manner. The functional meaning of a label depends on the characteristics of the application. Here's what we'll be in the future content

Gradually realize the role of XML tags.

Eight you can invent your own tags through XML

The labels in the previous example are not defined in any XML standard (such as <bookname>, <price>, and so on). These tags are invented by creators of documents

the. This is because XML does not have a predefined label. XML allows creators to define their own tags and their own document structure.

The tags used in HTML (and the structure of the HTML) are predefined. HTML documents Use only tags that have been defined in the HTML standard (such as

<p>,

Nine XML tree structure

As we can see in the example above, the XML document forms a tree structure that begins with "roots" and expands to "foliage".

An instance of an XML document

XML uses a simple, self-descriptive syntax:

<?xml version= "1.0" encoding= "UTF-8"?><note>     <to>George</to>    <from>john </from>    
The first line is the XML declaration. It defines the version of the XML (1.0)) and the encoding used (UTF-8,GBK, etc.);

The next line describes the root element of the document (like , "This document is a note"): <note>;

the next 4 lines describe the 4 child elements of the root (to, from, heading, and body): <to>George</to>, <from>John</from>,

<body>don ' t forget the meeting!</body>;

The last line defines the end of the root element:</note>.

From this example, it is conceivable that the XML document contains a note from John to George.

XML has a great self-descriptive nature, do you agree?

XML document forms a tree structure

The XML document must contain the root element. The element is the parent element of all other elements.

The elements in the XML document form a tree of documents. 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. The parent element has child elements. Sub-elements on the same level become compatriots (brother or sister

Sister). All elements can have text content and attributes (similar to HTML).

Instance


Represents a book in the following XML:

<bookstore><book category= "COOKING" >           <title lang= "en" >everyday italian</title>            <author>giada De laurentiis</author>            <year>2005</year>            <price>30.00</ price>        </book>       <book category= "Children" >           <title lang= "en" >harry potter</ Title>            <author>j K. rowling</author>            <year>2005</year>            <price>29.99 </price>        </book>       <book category= "WEB" >          <title lang= "en" >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>. All <book> elements in the document are included in the <bookstore>. <book> element has 4 sub-elements

:<title>, < author>, <year>, <price>.

10 XML use

XML is often used to simplify the storage and sharing of data.

(1) XML separates data from HTML

If you need to display dynamic Data in an HTML document, it will take a lot of time to edit the HTML whenever the data changes. Through XML, the number

according can be stored in a standalone XML file. This allows you to focus on using the HTM for layout and display, and to make sure that modifying the underlying data no longer requires

Any changes to the HTML. By using a few lines of JavaScript, you can read an external XML file and then update the contents of the data in the HTML.

(2) XML simplifies data sharing

In the real world, computer systems and data use incompatible formats to store data. The XML data is stored in plain text format, thus providing

A method of data storage independent of software and hardware. This makes it easier to create data that can be shared by different applications.

(3) XML simplifies data transfer

XML makes it easy to exchange data between incompatible systems. One of the most time-consuming challenges for developers is the internet

Exchange data between incompatible systems on the Because data can be read through a variety of incompatible applications, exchanging data in XML reduces this complexity

Of

(4) changes to the XML simplification platform

Upgrading to a new system (hardware or software platform) is always time-consuming. Large amounts of data must be converted, and incompatible data is often lost. XML number

It is stored in text format. This makes XML easier to extend or upgrade to new operating systems, new applications, or new bangs without losing data

Browser.

(5) XML makes your data more useful

Because XML is independent of hardware, software, and applications, XML makes your data more usable and useful. Different applications have access to your

Data, not just in an HTML page, but also from an XML data source. With XML, your data can be used by a variety of reading devices (handheld

Audio Devices, news readers, etc.) and can also be used by the blind or other persons with disabilities.

(6) XML for creating a new Internet language

Many of the new Internet languages are created through XML, including examples of:

A) XHTML-the latest HTML version

b) WSDL-used to describe the available Web service

c) WAP and WML-markup language for handheld devices

d) RSS-the language used for RSS feeds

e) RDF and OWL-used to describe resources and ontologies

f) SMIL-used to describe needles for web-based multimedia



XML Learning 1:xml Overview

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.