0% found this document useful (0 votes)
4 views13 pages

Upload 4

XML, or eXtensible Markup Language, is a markup language designed for storing and transporting data, emphasizing data structure over presentation, unlike HTML. It allows for self-descriptive data storage with user-defined tags and is extensible, enabling applications to adapt to changes in data without requiring significant modifications. XML's advantages include simplifying data sharing and transport across different systems, making it a versatile tool in web development and data management.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views13 pages

Upload 4

XML, or eXtensible Markup Language, is a markup language designed for storing and transporting data, emphasizing data structure over presentation, unlike HTML. It allows for self-descriptive data storage with user-defined tags and is extensible, enabling applications to adapt to changes in data without requiring significant modifications. XML's advantages include simplifying data sharing and transport across different systems, making it a versatile tool in web development and data management.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 13

Introduction to XML

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 Does Not Use Predefined Tags


The XML language has no predefined tags.
The tags in the example above (like <to> and <from>) are not defined in any XML standard.
These tags are "invented" by the author of the XML document.
HTML works with predefined tags like <p>, <h1>, <table>, etc.
With XML, the author must define both the tags and the document structure.

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.

It is a type of framework used to specify that it is


It is a predefined markup language.
a markup language.

It is a case-sensitive language. It is case-insensitive language.

It provides the structural details. It needs to provide the structural details.

The main purpose of XML is used to transfer the The main purpose of HTML is used to create and
data. design the webpage.

If there is a small error in the code, then it is


It does not allow any error in the coding.
ignored by the HTML.

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 is driven by content. The format drives HTML.

But in HTML, some tags do not have the closing


In XML, the closing tag is mandatory.
tag.

XML requires the code around XML attribute


Here no quote requires the value of the attribute.
values.

The convention should express all the objects in


XML. Most of the objects use elements and The HTML natively offers Object support.
attributes.

In XML, we need to use xsi:nil on elements in an


In HTML, the elements are recognized with the
XML instance document. We also need to import
help of a null value.
all the corresponding namespaces.

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, there is a requirement for the connection


In HTML, we can provide direct mapping for the
between the MAP application type to the element
application data.
and attribute of the XML.

In XML, we use the document, which is very


In HTML, we only use formatted text.
lengthy in size.

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.

There is a particular format for writing HTML code


There is no particular structure in the XML.
containing tags and attributes.

XML is neither a programming language nor a With the help of HTML, we can maintain the data
presentation language. presentation on the webpage.

It is a dynamic language. It is a static language.

In XML, data interchange is possible. In HTML, data interchange is not possible.

XML supports some data types. The supported


data types are Boolean, integer, duration, date, HTML supports no concept of datatype.
etc.

What is the Advantage of XML Compared to HTML?


There are some advantages of XML over HTML.

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.

What are the Advantages of HTML over XML?


There are some advantages of HTML over the XML.
1. With the help of HTML, we can design the web page's structure.
2. It is one of the first languages in which it is very easy to learn code.
3. It is not case-sensitive.
4. We can easily combine CSS and javascript with HTML.

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)

Another Example of XML: Books


File: books.xml

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>.

Another Example of XML: Emails


File: emails.xml

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:

No Technology Meaning Description


.

It is a clearer and stricter version of XML. It


Extensible belongs to the family of XML markup languages.
1) XHTML
html It was developed to make html more extensible
and increase inter-operability with other data.

XML It is a standard document model that is used to


2) XML DOM document access and manipulate XML. It defines the XML
object model file in tree structure.

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

XML query It is a XML based language which is used to


4) XQuery
language query XML based data.

Document It is an standard which is used to define the


5) DTD
type definition legal elements in an XML document.

XML schema It is an XML based alternative to dtd. It is used


6) XSD
definition to describe the structure of an XML document.

xlink stands for XML linking language. This is a


XML linking
7) XLink language for creating hyperlinks (external and
language
internal links) in XML documents.

It is a system for addressing components of XML


XML pointer based internet media. It allows the xlink
8) XPointer
language hyperlinks to point to more specific parts in the
XML document.

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.

web services It is an XML based language to describe web


10) WSDL description services. It also describes the functionality
languages offered by a web service.

RDF is an XML based language to describe web


Resource resources. It is a standard model for data
11) RDF description interchange on the web. It is used to describe
framework the title, author, content and copyright
information of a web page.

Scalable It is an XML based vector image format for two-


12) SVG vector dimensional images. It defines graphics in XML
graphics format. It also supports animation.

RSS is a XML-based format to handle web


Really simple content syndication. It is used for fast browsing
13) RSS
syndication for news and updates. It is generally used for
news like sites.

13

You might also like