0% found this document useful (0 votes)
48 views42 pages

Iwd Unit 5

The document provides information on XML (Extensible Markup Language) including: - XML allows users to define their own tags for storing and sharing data in a standardized format that can be understood across systems. - An XML document structure includes an XML declaration and user-defined tags. - XML separates data from presentation which allows the same XML data to be used in many presentation scenarios. - A DTD (Document Type Definition) defines rules for the structure and elements of an XML document, including what tags are allowed and how they are nested.

Uploaded by

Abhishek yadav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views42 pages

Iwd Unit 5

The document provides information on XML (Extensible Markup Language) including: - XML allows users to define their own tags for storing and sharing data in a standardized format that can be understood across systems. - An XML document structure includes an XML declaration and user-defined tags. - XML separates data from presentation which allows the same XML data to be used in many presentation scenarios. - A DTD (Document Type Definition) defines rules for the structure and elements of an XML document, including what tags are allowed and how they are nested.

Uploaded by

Abhishek yadav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 42

XML

UNIT 5

Shalini Shukla
XML INTRODUCTION
 XML (Extensible Markup Language) is a markup language
similar to HTML, but without predefined tags to use.
 Instead, you define your own tags designed specifically for your
needs.
 This is a powerful way to store data in a format that can be
stored, searched, and shared.
 Most importantly, since the fundamental format of XML is
standardized, if you share or transmit XML across systems or
platforms, either locally or over the internet, the recipient can still
parse the data due to the standardized XML syntax.
 Structure of an XML document

 Whole structure XML and XML based languages built on tags.

XML declaration
 XML - declaration is not a tag. It is used for the transmission of
the meta-data of a document.
 <?xml version="1.0" encoding="UTF-8"?>
FEATURES OF XML
 Xml (eXtensible Markup Language) is a mark up language.
 XML is designed to store and transport data.

 Xml was released in late 90’s. it was created to provide an


easy to use and store self describing data.
 XML became a W3C Recommendation on February 10, 1998.

 XML is not a replacement for HTML.

 XML is designed to be self-descriptive.

 XML is designed to carry data, not to display data.

 XML tags are not predefined. You must define your own tags.

 XML is platform independent and language independent.


ADVANTAGES OF XML

 XML is widely used in the era of web development. It is


also used to simplify data storage and data sharing.

 Platform Independent and Language


Independent: The main benefit of xml is that you can
use it to take data from a program like Microsoft SQL,
convert it into XML then share that XML with other
programs and platforms.
DISPLAYING XML USING CSS
 An XML file can be displayed using two ways. These are as
follows :-
 Cascading Style Sheet

 Extensible Stylesheet Language Transformation Displaying


XML file using CSS :
CSS can be used to display the contents of the XML document in
a clear and precise manner. It gives the design and style to whole
XML document.
 Basic steps in defining a CSS style sheet for XML :
For defining the style rules for the XML document, the following
things shoulde be done :-
 Define the style rules for the text elements such as font-size, color, font-weight,
etc.
 Define each element either as a block, inline or list element, using the display

property of CSS.
 Identify the titles and bold them.
 Linking XML with CSS :
In order to display the XML file using CSS, link XML file with CSS.
Below is the syntax for linking the XML file with CSS:
 <?xml-stylesheet type="text/css"
href="name_of_css_file.css"?>
XML file :
<?xml version="1.0" encoding="UTF-8"?> <book>
<?xml-stylesheet type="text/css" href="Rule.css"?> <title>Title -: Computer Networks</title>
<author>Author -: Foruouzan</author>
<books> <publisher>Publisher -: Mc Graw
<heading>Welcome To XML </heading> Hill</publisher>
<book> <edition>Edition -: 5</edition>
<price>Price -: 700</price>
<title>Title -: Web Programming</title> </book>
<author>Author -: abc</author> <book>
<title>Title -: DBMS Concepts</title>
<publisher>Publisher -: Wiley</publisher>
<author>Author -: Navath</author>
<edition>Edition -: 3</edition> <publisher>Publisher -: Oxford</publisher>
<price> Price -: 300</price> <edition>Edition -: 5</edition>
<price>Price -: 600</price>
</book>
</book>
<book> <book>
<title>Title -: Internet world-wide-web</title> <title>Title -: Linux Programming</title>
<author>Author -: Subhitab Das</author>
<author>Author -: Ditel</author> <publisher>Publisher -: Oxford</publisher>
<publisher>Publisher -: Pearson</publisher> <edition>Edition -: 8</edition>
<edition>Edition -: 3</edition> <price>Price -: 300</price>
</book>
<price>Price -: 400</price> </books>
</book>
CSS FILE :
Creating Rule.css as:-
books {
color: white;
background-color : gray;
width: 100%;
}
heading {
color: green;
font-size : 40px;
background-color : powderblue;
}
heading, title, author, publisher, edition, price {
display : block;
}
title {
font-size : 25px;
font-weight : bold;
}
DATA INTERCHANGE USING XML
DOCUMENT
 Data in XML markup language can easily be integrated with
other software components that support XML.

 Web servers can provide XML documents along with a


stylesheet, thus separating the data content from its
presentation, and preserving the data in its native form for easy
searching.

 Using XSLT, Extensible Stylesheet Language Transformations,


businesses can reformat XML documents received from other
businesses into their desired style.
 XML (eXtensible Markup Language) is a data transfer format.

 It is not a miracle cure, but it is a standardised way of


structuring data.

 This means that if you can get suitable data out of one
application in XML format, you can usually use a translator
tool (such as XSLT) to transform it into a form suitable for the
destination application.

 This means that transfer of information becomes a lot easier


when all applications support XML.

 XML Separates Data from Presentation

 XML does not carry any information about how to be


 The same XML data can be used in many different presentation scenarios.
 Because of this, with XML, there is a full separation between data and
presentation.

XML DTD

What is DTD
 DTD stands for Document Type Definition.

 A Document Type Definition (DTD) describes the tree structure of a


document and something about its data.
 It is a set of markup affirmations that actually define a type of document
for the SGML family, like GML, SGML, HTML, XML. 
 A DTD can be declared inside an XML document as inline or as an
external recommendation.
 DTD determines how many times a node should appear, and how their
child nodes are ordered.
There are 2 data types, PCDATA and CDATA
 PCDATA is parsed character data.

 CDATA is character data, not usually parsed.

 Syntax:

<!DOCTYPE element DTD identifier


[
first declaration
second declaration . .
nth declaration ]
>
Example
DTD FOR THE ABOVE TREE IS:
XML DOCUMENT WITH AN INTERNAL DTD:
<?xml version="1.0"?> <address>
<!DOCTYPE address [     <name>
<!ELEMENT address (name, email,         <first>Rohit</first>
phone, birthday)>         <last>Sharma</last>
    </name>
<!ELEMENT name (first, last)>
    <email>[email protected]
<!ELEMENT first (#PCDATA)> om</email>
<!ELEMENT last (#PCDATA)>     <phone>9876543210</
<!ELEMENT email (#PCDATA)> phone>
    <birthday>
<!ELEMENT phone (#PCDATA)>
        <year>1987</year>
<!ELEMENT birthday (year, month,         <month>June</month>
day)>         <day>23</day>
<!ELEMENT year (#PCDATA)>     </birthday>
<!ELEMENT month (#PCDATA)> </address>
<!ELEMENT day (#PCDATA)>
]>
The DTD above is interpreted like this:
 !DOCTYPE address defines that the root element of this document is
address.
 !ELEMENT address defines that the address element must contain
four elements: “name, email, phone, birthday”.
 !ELEMENT name defines that the name element must contain two
elements: “first, last”.
  !ELEMENT firstdefines the first element to be of type “#PCDATA”.
 !ELEMENT last defines the last element to be of type “#PCDATA”.

 !ELEMENT email defines the email element to be of type


“#PCDATA”.
 !ELEMENT phone defines the phone element to be of type
“#PCDATA”.
 !ELEMENT birthday defines that the birthday element must contain
three elements “year, month, day”.
 !ELEMENT year defines the year element to be of type “#PCDATA”.
 !ELEMENT month defines the month element to be of type “#PCDATA”.
 !ELEMENT day defines the day element to be of type “#PCDATA”.
XML DOCUMENT WITH AN EXTERNAL DTD:
<?xml version="1.0"?>
<!DOCTYPE address SYSTEM "address.dtd">
<address>
    <name>
        <first>Rohit</first>
        <last>Sharma</last>
    </name>
    <email>[email protected]</email>
    <phone>9876543210</phone>
    <birthday>
        <year>1987</year>
        <month>June</month>
        <day>23</day>
    </birthday>
</address>
ADDRESS.DTD:
 <!ELEMENT address (name, email, phone, birthday)>
 <!ELEMENT name (first, last)>
 <!ELEMENT first (#PCDATA)>
 <!ELEMENT last (#PCDATA)>

 <!ELEMENT email (#PCDATA)>


 <!ELEMENT phone (#PCDATA)>

 <!ELEMENT birthday (year, month, day)>


 <!ELEMENT year (#PCDATA)>
 <!ELEMENT month (#PCDATA)>
 <!ELEMENT day (#PCDATA)>
output
XML PARSERS
 An XML parser is a software library or package that provides
interfaces for client applications to work with an XML document.
 The XML Parser is designed to read the XML and create a way
for programs to use XML.
 XML parser validates the document and check that the document
is well formatted.
 Let's understand the working of XML parser by the figure given
below:
TYPES OF XML PARSERS
 DOM
 SAX
DOM (Document Object Model)
 A DOM document is an object which contains all the information of an XML
document.
 It is composed like a tree structure.
 The DOM Parser implements a DOM API. This API is very simple to use.
Features of DOM Parser
 A DOM Parser creates an internal structure in memory which is a DOM document
object and the client applications get information of the original XML document
by invoking methods on this document object.
 DOM Parser has a tree based structure.
Advantages
 1) It supports both read and write operations and the API is very simple to use.
 2) It is preferred when random access to widely separated parts of a document is
required.
DISADVANTAGES
 1) It is memory inefficient. (consumes more memory because the
whole XML document needs to loaded into memory).
 2) It is comparatively slower than other parsers.

SAX (Simple API for XML)


 A SAX Parser implements SAX API. This API is an event based
API and less intuitive.
Features of SAX Parser
 It does not create any internal structure.

 Clients does not know what methods to call, they just overrides the
methods of the API and place his own code inside method.
 It is an event based parser, it works like an event handler in Java.

Advantages
 1) It is simple and memory efficient.

 2) It is very fast and works for huge documents.


DISADVANTAGES
 1) It is event-based so its API is less intuitive.
 2) Clients never know the full information because the data is broken into
pieces.

XML DOM
 DOM is an acronym stands for Document Object Model. It defines a
standard way to access and manipulate documents.
 The Document Object Model (DOM) is a programming API(Application
programming interface) for HTML and XML documents.
 It defines the logical structure of documents and the way a document is
accessed and manipulated.
 As a W3C specification, one important objective for the Document Object
Model is to provide a standard programming interface that can be used in a
wide variety of environments and applications.
 The Document Object Model can be used with any programming language.

 XML DOM defines a standard way to access and manipulate XML


documents.
WHAT DOES XML DOM
 The XML DOM makes a tree-structure view for an XML
document.

 We can access all elements through the DOM tree.

 We can modify or delete their content and also create new


elements.

 The elements, their content (text and attributes) are all known
as nodes.

 For example, consider this table, taken from an HTML


document:
THE DOCUMENT OBJECT MODEL REPRESENTS THIS
TABLE LIKE THIS:
XML USAGE

 A short list of XML usage says it all:


 XML can work behind the scene to simplify the creation of
HTML documents for large web sites.
 XML can be used to exchange the information between
organizations and systems.
 XML can be used for offloading and reloading of databases.

 XML can be used to store and arrange the data, which can
customize your data handling needs.
 XML can easily be merged with style sheets to create
almost any desired output.
 Virtually, any type of data can be expressed as an XML
document.
XML ON THE SERVER

 XML files are plain text files just like HTML files.
 XML can easily be stored and generated by a standard web
server.
Storing XML Files on the Server
 XML files can be stored on an Internet server exactly the same
way as HTML files.

 <?xml version="1.0" encoding="UTF-8"?>
<note>
  <from>Jani</from>
  <to>Tove</to>
  <message>Remember me this weekend</message>
</note>
GENERATING XML WITH PHP

 <?php
header("Content-type: text/xml");
echo "<?xml version='1.0' encoding='UTF-8'?>";
echo "<note>";
echo "<from>Jani</from>";
echo "<to>Tove</to>";
echo "<message>Remember me this weekend</message>";
echo "</note>";
?>
COMMON GATEWAY INTERFACE (CGI)
 The Common Gateway Interface (CGI) provides the
middleware between WWW servers and external databases and
information sources.

 The World Wide Web Consortium (W3C) defined the Common


Gateway Interface (CGI) and also defined how a program
interacts with a Hyper Text Transfer Protocol (HTTP) server.

 The Web server typically passes the form information to a small


application program that processes the data and may send back
a confirmation message.

 This process or convention for passing data back and forth


between the server and the application is called the common
gateway interface (CGI).
WORKING OF CGI (COMMON
GATEWAY INTERFACE)
PERL
 Perl is a general-purpose programming language originally
developed for text manipulation and now used for a wide range
of tasks including system administration, web development,
network programming, GUI development, and more.
 Perl is a stable, cross platform programming language.

 Though Perl is not officially an acronym but few people used it


as Practical Extraction and Report Language.
 It is used for mission critical projects in the public and private
sectors.
 Perl is an Open Source software, licensed under its Artistic
License, or the GNU General Public License (GPL).
 Perl was created by Larry Wall.

 Perl 1.0 was released to usenet's alt.comp.sources in 1987.

 Perl is listed in the Oxford English Dictionary.


PERL FEATURES
 Perl takes the best features from other languages, such as C, awk,
sed, sh, and BASIC, among others.
 Perls database integration interface DBI supports third-party
databases including Oracle, Sybase, Postgres, MySQL and others.
 Perl works with HTML, XML, and other mark-up languages.

 Perl supports Unicode.

 Perl is Y2K compliant.

 Perl supports both procedural and object-oriented programming.

 Perl interfaces with external C/C++ libraries through XS or SWIG.

 Perl is extensible. There are over 20,000 third party modules


available from the Comprehensive Perl Archive Network (CPAN).
 The Perl interpreter can be embedded into other systems.
RMI
 The RMI (Remote Method Invocation) is an API that provides a Mechanism to
create distributed application in java.
 The RMI allows an object to invoke methods on an object running in another
JVM.
 The RMI provides remote communication between the applications using two
objects stub and skeleton.
STUB
 The stub is an object, acts as a gateway for the client side. All the outgoing
requests are routed through it.
 It resides at the client side and represents the remote object. When the caller
invokes method on the stub object, it does the following tasks:
 It initiates a connection with remote Virtual Machine (JVM),

 It writes and transmits (marshals) the parameters to the remote Virtual Machine
(JVM),
 It waits for the result

 It reads (unmarshals) the return value or exception, and

 It finally, returns the value to the caller.


SKELETON
 The skeleton is an object, acts as a gateway for the server side
object.
 All the incoming requests are routed through it.

 When the skeleton receives the incoming request, it does the


following tasks:
 It reads the parameter for the remote method

 It invokes the method on the actual remote object, and

 It writes and transmits (marshals) the result to the caller.


IN THE JAVA 2 SDK, AN STUB PROTOCOL WAS
INTRODUCED THAT ELIMINATES THE NEED FOR
SKELETONS. 
WHAT IS COM?

 Microsoft's component program architecture, COM


(Component Object Model), was mainly designed for
Windows.

 It is the basis upon which OLE and ActiveX are built, and it
allows code to be reused without being recompiled.

 A component in COM is a platform-specific binary file that


conforming apps and other components can use.
WHAT IS DCOM?

 DCOM is a programming technique that allows a


computer to run programs on a remote computer as if
they were running locally.

 The Distributed Component Object Model (DCOM) is


an acronym for Distributed Component Object Model.

 It is a software component that enables COM objects to


communicate over the network.
THE FOLLOWING TABLE HIGHLIGHTS THE MAJOR
POINTS THAT DIFFERENTIATE COM AND DCOM −
VBSCRIPT
 Microsoft VBScript(Visual Basic Script) is a general-purpose,
lightweight and active scripting language developed by
Microsoft that is modeled on Visual Basic.

 Nowadays, VBScript is the primary scripting language for


Quick Test Professional (QTP), which is a test automation tool.

 This tutorial will teach you how to use VBScript in your day-
to-day life of any Web-based or automation project
development.
YOUR FIRST VBSCRIPT
 Let us write a VBScript to print out "Hello World".
<html>
<body> <script language = "vbscript" type = "text/vbscript">
document.write("Hello World!")
</script>
</body>
</html>
In the above example, we called a function document.write,
which writes a string into the HTML document. This function
can be used to write text, HTML or both.
SINGLE LINE SYNTAX

Colons are used when two or more lines of VBScript ought


to be written in a single line.

Hence, in VBScript, Colons act as a line separator.

<script language = "vbscript" type = "text/vbscript"> var1


= 10 : var2 = 20 </script>
MULTIPLE LINE SYNTAX
 When a statement in VBScript is lengthy and if user wishes to
break it into multiple lines, then the user has to use underscore
"_".

 This improves the readability of the code. The following example


illustrates how to work with multiple lines.

<script language = "vbscript" type = "text/vbscript">


var1 = 10
var2 = 20
Sum = var1 + var2
document.write("The Sum of two numbers"&_"var1 and var2 is " &
Sum)
</script>
ASP

 ASP stands for Active Server Pages

 ASP is a development framework for building web pages.

 ASP and ASP.NET are server side technologies.

 Both technologies enable computer code to be executed by an


Internet server.

 When a browser requests an ASP or ASP.NET file, the ASP


engine reads the file, executes any code in the file, and returns
the result to the browser.
EASY LEARNING WITH "RUN EXAMPLE"
 Our "Run Example" tool displays the ASP.NET code and the
HTML output simultaneously.
 Click on the "Run Example" button to see how it works:

Web Pages Example


<html>
<body>
     <h1>Hello Web Pages</h1>
     <p>The time is @DateTime.Now</p>
</body>
</html>
OUTPUT:
Hello Web Pages
The time is 12/22/2021 10:05:13 AM

You might also like