XML is designed to transmit and store data.
HTML is designed to display data.
What is XML?
- XML refers to Extensible Markup Language (EXtensible Markup Language)
- XML is a markup language , much like HTML
- XML is designed to transmit data rather than display it
- XML tags are not predefined. You need to define your own labels .
- XML is designed to be self-descriptive .
- XML is the recommended standard for the consortium
The main differences between XML and HTML
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 the content of the data.
HTML is designed to display data with the focus on the appearance of the data.
HTML is designed to display information, while XML is designed to transmit information.
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, an application capable of reading XML can handle XML tags in a targeted manner. The functional meaning of a label depends on the characteristics of the application.
XML is applied to many aspects of web development and is often used to simplify the storage and sharing of data.
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.
With XML, data can be stored in a separate XML file. This allows you to focus on using HTML 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.
XML simplifies data sharing
In the real world, computer systems and data use incompatible formats to store data.
XML data is stored in plain text format, thus providing a software-and hardware-independent approach to data storage.
This makes it easier to create data that can be shared by different applications.
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 exchange of data between incompatible systems on the Internet.
Exchanging data in XML reduces this complexity because data can be read through a variety of incompatible applications.
XML to create a new Internet language
Many of the new Internet languages are created through XML:
Examples of these include:
- XHTML-the latest HTML version
- WSDL-Used to describe the available Web service
- WAP and WML-markup language for handheld devices
- RSS-The language used for RSS feeds
- RDF and OWL-used to describe resources and ontologies
- SMIL-Used to describe needles for web-based multimedia
==============================================================================================
An instance of an XML document
XML uses a simple, self-descriptive syntax:
<?xml version= "1.0" encoding= "iso-8859-1"? ><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 (iso-8859-1 = latin-1/Western European character set).
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>
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 structureThe 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. Child elements at the same level become siblings (brothers or sisters).
All elements can have text content and attributes (similar to HTML).
XML Learning note I (Overview)