Notes Lec 2.docx
Notes Lec 2.docx
Notes Lec 2.docx
Extensible Markup Language (XML) is a markup language that is a core part of web
technology and is used to store and share data across systems:
• Data storage
XML is a way to store data in a format that can be searched, shared, and stored.
• Data exchange
XML allows for the exchange of information between systems such as websites,
databases, and third-party applications.
• Data definition
XML is a flexible way to create information formats and define data. Users can define
their own tags to meet their needs.
• Data sharing
XML is platform-independent and language-independent, so it can be processed by
any modern language on any operating system.
• Data presentation
XML is used in web services to format and exchange data, such as user information,
product details, and transactions.
XML is similar to HTML, but it is more universal and does not have predefined
tags. XML documents are stored as American Standard Code for Information
Interchange (ASCII) files and can be edited using any text editor.
HTML: (Hyper Text Markup Language) is used to create web pages and web
applications. It is a markup language. By HTML we can create our static page. It is used
for displaying the data not to transport the data.
HTML is a combination of Hypertext and Markup language. Hypertext defines the link
between the web pages. A markup language is used to define the text document within the
tag which defines the structure of web pages. This language is used to annotate (make
notes for the computer) text so that a machine can understand it and manipulate text
accordingly
<head>
<title>WEB TECHNOLOGY</title>
</head>
<body>
<h1 style="color: green;">
WEB TECHNOLOGY
</h1>
<p>
A Computer Science Subject
</p>
</body>
</html>
<contactinfo>
<name>FG College</name>
<College>WEB Technology</College>
<mobile>2345456767</mobile>
</address>
</contactinfo>
HTML stands for Hyper Text Markup XML stands for Extensible Markup
Language. Language.
HTML can ignore small errors. XML does not allow errors.
HTML tags are predefined tags. XML tags are user-defined tags.
There are limited number of tags in HTML. XML tags are extensible.
HTML does not preserve white spaces. White space can be preserved in XML.
HTML tags are used for displaying the XML tags are used for describing the data
data. not for displaying.
In HTML, closing tags are not necessary. In XML, closing tags are necessary.
XML Features
As a markup language and a file format, XML offers a multitude of features that make it
versatile for encoding, storing, and transporting data:
• Human and machine readability: XML data is stored in plain text format, facilitating
interpretation by both humans and machines.
• Self-descriptive: XML documents are self-descriptive. The tags in XML provide a general
idea of the type of data they contain.
• Extensible: XML, true to its name, permits users to define their own tags, thereby offering
flexibility to represent a wide range of data structures.
• Platform and language independence: XML data can be processed by any system that
can process XML, making it an excellent choice for data interchange.
In a way, XML itself does not achieve anything. Instead, it serves as a means to structure
and describe data. Developers then use this structured data in various applications for
different purposes, such as data exchange, configuration files, message passing in
distributed systems, and much more.
Syed Iqbal Haider Kazmi
XML Languages & And Applications
XML namespaces:
XML namespaces prevent naming conflicts between elements and attributes in XML
documents, especially when various XML vocabularies are joined or elements with the
same name come from different sources.
Syntax:
<root xmlns="http://example.com/ns">
<child>Content</child>
</root>
Example
<?xml version="1.0" encoding="UTF-8"?> <--Unicode Transformation Format-8-bit -->
<library
xmlns="http://example.com/library">
<book>
<title>XML Basics</title>
<author>John Doe</author>
</book>
<book>
<title>Advanced XML</title>
<author>Jane Smith</author>
</book>
</library>
Now XSLT document can contain one or more templates. Templates actually define the
rules that you want to place for the elements. The template has an attribute called match.
In the attribute, we try to give the Xpath expression [ match = “/” ] which tries to match
the pattern in the source XML document.
Document structure of XSLT
<? xml version = "1.0" ?>
<xsl : stylesheet version = "1.0" xmlns : xsl =
"https://www.w3.org/1999/XSL/Transform">
<xsl : stylesheet>
<xsl : template match="/" >
[action]
<xsl : template>
<xsl : template match="/" >
[action]
<xsl : template>
--------------------
</xsl : stylesheet>
Syntax
<!DOCTYPE element DTD identifier
[
declaration #1
declaration #2
.
.
declaration #n
] >
The start of the document has a doctype delimiter. DOCTYPE has two types of
declarations:
1. External subset declaration (optional)
2. Internal subset declaration (optional)
While the internal declaration is specified in the document itself as a part of DOCTYPE,
the external one is to be mentioned in a separate file. To refer to the external subset,
public identifiers are used. An element instructs to parse the document from the root
element. DTD identifier is the path to a system file or URL that points to any file on the
internet. An optional list of entity declarations is enclosed inside square brackets ([]).
XSD:
XSD stands for XML Schema Definition, it is like a detailed plan for organizing and
checking XML documents. It is a versatile language that provides a framework to structure
and validate XML data effectively. it is a set of guidelines and limitations designed to
ensure the reliability, consistency, and correctness of data stored in XML files. it specifies
what elements, attributes, and data types are allowed in an XML document, serving as a
rulebook that XML documents must adhere to. It also empowers developers to define
constraints, like setting the acceptable value ranges for elements and enforcing specific
formatting rules for data. XML Schema Definition (XSD) files are saved with the .xsd file
extension.
Advantages of XSD
• XSD schemas are like user-friendly guides for XML data. They tell developers how the
data should be structured and the rules it must follow, all without needing extra
explanations.
• Helps different systems and apps work together smoothly by creating a common
language for organizing and checking data.
• Lets you set automatic values for missing parts in your data. It’s like having
placeholders ready, so if some information is missing, it gets filled in with the default
values. This keeps your data consistent.
• XSD checks data to make sure it’s correct, stopping any mistakes from getting into
XML documents.
• Provides different data types, like primitive data types, derived data types, and user-
defined data types. This variety helps keep data organized and dependable.
Disadvantages of XSD
• Creating and maintaining XSD schemas can be complex, especially for intricate XML
structures.
• Understanding and working with XSD can be challenging for those new to XML and
related technologies.
• Data validation using XSD can introduce a performance overhead, especially for large
XML documents.
Use Cases of XSD
• XSD is like a blueprint for how messages in web services should be arranged, it make
sure that the data shared between systems is neatly organized and error free.
• Helps in linking XML data with database layouts, making it easier to move data
between XML based systems and databases. It’s like a bridge that connects them.
• Lots of computer programs use setup files written in XML, and XSD helps explain how
these files should be organized and what rules they need to follow.
• XSD is really important for checking and making sure XML documents are correct,
especially in places like finance or healthcare, where getting the data right is super
important.
XSD is a powerful and versatile language that allows the users to define and validate the
XML data. It also has some disadvantages and challenges that users should aware of but
the features, advantages and uses cases of XSD are so much useful for working with XML
data that we can simply ignore the disadvantages. Nevertheless, It is an essential
technology for creating and painting the reliable, consistent, and correct XML data.
Advantages of XHTML MP
The greatest advantage brought by XHTML MP is that developers can now use the
same technologies for the development of both web sites and WAP sites. This
benefits WAP application development in the following ways:
• If you are familiar with web technologies such as HTML, XHTML, and CSS,
you can start developing your WAP site almost immediately. If you are new to
the above web technologies and now you learn XHTML MP, you learn at the
same time how to write markup code for the web.
• The same development tools can be used to develop both web sites and WAP
sites. You can stick to your web development tools to build your mobile
Internet browsing application. This results in a lower development cost (no
need to buy new development tools) and a lower time investment (no need to
learn new development tools).
• Ordinary web browsers can be used to view your WAP site during the
development process. (You should test your WAP site with emulators and real
Syed Iqbal Haider Kazmi
XML Languages & And Applications
mobile phones before the final release, since the characteristics [e.g. screen
size, number of colors supported] of real mobile devices vary considerably.)
• HTML / XHTML pages on your web site can be converted to XHTML MP
documents with minor changes or even without any changes. (However, you
have to make sure that the layout of the HTML / XHTML pages looks nicely on
a small screen and that the file size does not exceed the maximum page size
of your targeted mobile devices.)
• It becomes easier to find a developer to join your mobile Internet application
development team, since there are plenty of web developers on the job
market.
• XHTML MP supports WAP CSS, which enables the separation of content and
presentation in different files. As you all know, mobile devices have very
different characteristics such as screen sizes. The separation of the content
and the presentation means you can write the content once, and change the
style and layout to suit different mobile devices with various WAP CSS files.
• With XHTML MP and WAP CSS, you have more control over the presentation.
For example, you can control borders, backgrounds, margins, padding, etc.
You can also specify the font sizes, font families and font colors. Such features
are not available in WML 1.x.