Upload 4
Upload 4
https://www.w3schools.com/xml/xml_whatis.asp
XML is a software- and hardware-independent tool for storing and transporting data.
What is XML?
XML stands for eXtensible Markup Language
XML is a markup language much like HTML
XML was designed to store and transport data
XML was designed to be self-descriptive
XML is a W3C Recommendation
XML Does Not DO Anything
Maybe it is a little hard to understand, but XML does not DO anything.
This note is a note to Tove from Jani, stored as XML:
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
The XML above is quite self-descriptive:
It has sender information
It has receiver information
It has a heading
It has a message body
But still, the XML above does not DO anything. XML is just information wrapped in tags.
Someone must write a piece of software to send, receive, store, or display it:
1
The Difference Between XML and HTML
XML and HTML were designed with different goals:
XML was designed to carry data - with focus on what data is
HTML was designed to display data - with focus on how data looks
XML tags are not predefined like HTML tags are
ADVERTISEMENT
XML is Extensible
Most XML applications will work as expected even if new data is added (or removed).
Imagine an application designed to display the original version of note.xml (<to> <from>
<heading> <body>).
Then imagine a newer version of note.xml with added <date> and <hour> elements, and a
removed <heading>.
The way XML is constructed, older version of the application can still work:
<note>
<date>2015-09-01</date>
2
<hour>08:30</hour>
<to>Tove</to>
<from>Jani</from>
<body>Don't forget me this weekend!</body>
</note>
https://www.javatpoint.com/features-and-advantages-of-xml
3
Features and Advantages of XML
XML is widely used in the era of web development. It is also used to simplify data storage
and data sharing.
The main features or advantages of XML are given below.
1) XML separates data from HTML
If you need to display dynamic data in your HTML document, it will take a lot of work to edit
the HTML each time the data changes.
With XML, data can be stored in separate XML files. This way you can focus on using
HTML/CSS for display and layout, and be sure that changes in the underlying data will not
require any changes to the HTML.
With a few lines of JavaScript code, you can read an external XML file and update the data
content of your web page.
2) XML simplifies data sharing
In the real world, computer systems and databases contain data in incompatible formats.
XML data is stored in plain text format. This provides a software- and hardware-independent
way of storing data.
This makes it much easier to create data that can be shared by different applications.
3) XML simplifies data transport
One of the most time-consuming challenges for developers is to exchange data between
incompatible systems over the Internet.
Exchanging data as XML greatly reduces this complexity, since the data can be read by
different incompatible applications.
4) XML simplifies Platform change
Upgrading to new systems (hardware or software platforms), is always time consuming.
Large amounts of data must be converted and incompatible data is often lost.
XML data is stored in text format. This makes it easier to expand or upgrade to new
operating systems, new applications, or new browsers, without losing data.
5) XML increases data availability
Different applications can access your data, not only in HTML pages, but also from XML data
sources.
With XML, your data can be available to all kinds of "reading machines" (Handheld
computers, voice machines, news feeds, etc), and make it more available for blind people, or
people with other disabilities.
4
6) XML can be used to create new internet languages
A lot of new Internet languages are created with XML.
Here are some examples:
o XHTML
o WSDL for describing available web services
o WAP and WML as markup languages for handheld devices
o RSS languages for news feeds
o RDF and OWL for describing resources and ontology
o SMIL for describing multimedia for the web
https://www.javatpoint.com/html-vs-xml
XML vs HTML
5
XML HTML
XML stands for Extensible Markup Language. HTML stands for a hypertext markup language.
The main purpose of XML is used to transfer the The main purpose of HTML is used to create and
data. design the webpage.
Whitespace is allowed in the code of XML. Whitespace is not allowed in the code of HTML.
In XML, we have to perform the nesting operation The nesting of code does not affect the HTML
appropriately. code.
XML supports the namespace. With the help of a The concept of namespace does not supported by
6
namespace, we can remove the collision risk HTML. In HTML, we can avoid the naming collision
created when we combine it with another by implementing prefixes in the object or
document. performing nesting operations.
In XML, we use the implementation of the XML In HTML, the parsing of javascript there is no code
DOM for parsing the javascript. required for parsing the text.
Learning technology like XPath, XML Schema, It is a simple technology that is very popular
DOM, etc, is much more difficult. among the developer.
In XML, all the tags are enclosed by the closing In HTML, all the tags are enclosed by the angle
square bracket. bracket.
XML is neither a programming language nor a With the help of HTML, we can maintain the data
presentation language. presentation on the webpage.
7
1. The major advantage of XML over HTML is with XML, we can transfer the data to any
other platform. For example, if we want to transfer data between an application and
a database, we can easily achieve this with the help of XML. But it is not possible in
the case of HTML.
2. All the data and information are stored in XML in different locations.
3. XML is an independent platform that is supported in any application.
4. XML is an extendable language, i.e., we can add or remove the information at any
time.
5. XML is very difficult to learn as we need to learn XPath, XML schema, etc.
6. With the help of XML, it is very much simple to handle the processing of information
structure.
7. With the help of XML, we can reduce the complexity of the code.
8. With the help of XML, we can create our own tags.
https://www.javatpoint.com/xml-example
XML Example
8
XML documents create a hierarchical structure looks like a tree so it is known as XML Tree
that starts at "the root" and branches to "the leaves".
Example of XML Document
XML documents uses a self-describing and simple syntax:
The first line is the XML declaration. It defines the XML version (1.0) and the encoding used
(ISO-8859-1 = Latin-1/West European character set).
he next line describes the root element of the document (like saying: "this document is a
note"):
1. <note>
The next 4 lines describe 4 child elements of the root (to, from, heading, and body).
1. <to>Tove</to>
2. <from>Jani</from>
3. <heading>Reminder</heading>
4. <body>Don't forget me this weekend!</body>
And finally the last line defines the end of the root element.
1. </note>
XML documents must contain a root element. This element is "the parent" of all other
elements.
The elements in an XML document form a document tree. The tree starts at the root and
branches to the lowest level of the tree.
All elements can have sub elements (child elements).
1. <root>
2. <child>
3. <subchild>.....</subchild>
4. </child>
9
5. </root>
The terms parent, child, and sibling are used to describe the relationships between
elements. Parent elements have children. Children on the same level are called siblings
(brothers or sisters).
All elements can have text content and attributes (just like in HTML)
The root element in the example is <bookstore>. Allelements in the document are contained
within <bookstore>.
The <book> element has 4 children: <title>,< author>, <year> and <price>.
10
https://www.javatpoint.com/xml-related-technologies
XML Related Technologies
11
Here we have pointed out XML related technologies. There are following XML related
technologies:
XSL
it contain
i) It transforms XML into other formats, like
three parts: Extensible
html.
3) i) XSLT (xsl style sheet
ii) It is used for formatting XML to screen, paper
transform) language
etc.
ii) XSL
iii) It is a language to navigate XML documents.
iii)XPath
12
It is an acronym stands simple object access
Simple object protocol. It is XML based protocol to let
9) SOAP access applications exchange information over http. in
protocol simple words you can say that it is protocol used
for accessing web services.
13