0% found this document useful (0 votes)
11 views

Unit 7 XML

Uploaded by

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

Unit 7 XML

Uploaded by

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

Unit 7

Extensible Markup Language (XML)


Introduction:
XML (eXtensible Markup Language) is a versatile markup language that is widely used for data
representation and exchange. It was developed by the World Wide Web Consortium (W3C) and
was first released in 1998. XML was designed to store and transport data, making it easy for both
humans and machines to read and interpret the data.

Features of XML: (characteristics of XML)


Self-descriptive: XML’s user-defined tags make data content easily understandable.
Structured and Hierarchical: XML organizes data in a tree-like, nested structure, ideal for
complex datasets.
Platform-independent: XML enables data sharing across diverse systems and platforms.
Text-based Format: XML’s plain text format can be edited with any text editor.
Extensible: XML lets users create custom tags, supporting flexible data representation.
Supports Unicode: XML’s Unicode support allows for international characters and data
exchange.
Well-formed and Valid: XML must follow syntactic rules and can be schema-validated.
Human-readable: XML’s text-based, self-descriptive format is more readable than binary
formats.

Uses of XML: (why is XML needed?)


Data Sharing: XML is used to share data between different systems, especially in APIs.
App Settings: Many apps use XML to save settings that can be easily changed.
Document Structure: XML structures documents like web pages (XHTML) and graphics
(SVG).
Web Services: XML is used to send and receive messages between online services.
Saving Complex Data: XML can store complex data in a structured way for storage or
transfer.
Managing Content: Many content systems use XML to organize and handle content for
easy access.

Difference Between:
HTML XML
➢ It was designed for displaying data on ➢ It was designed to store and transport data.
web pages.
➢ It focuses on presentation of data. ➢ It focuses on structure and meaning of data.
➢ It uses predefined tags (ex: <div>, <h1>, ➢ It allows users to create custom tags (ex:
etc). <name>, <book>, <address>, etc).
➢ It is flexible with the syntax. ➢ It is strict with the syntax.
➢ It is not self-descriptive. ➢ It is self-descriptive with custom tags.
➢ It is not extensible, limited to ➢ It is extensible I.e. users can create any type
predefined tags. of necessary tags.
Example: Afai lekhne, ya thau pugdaina! Example: Afai lekhne, ya thau pugdaina!

--Made by Bishal Bhat-- 1


XML document Rules:
The XML document must follow the following rules:
Single Root Element: An XML document must have exactly one root element that
encloses all other elements.
Proper Tag Closure: Every opening tag must have a corresponding closing tag.
Example: <book>...</book>.
Case Sensitivity: XML tags are case-sensitive, so <tag>, <Tag>, and <TAG> are considered
as different elements.
Proper Nesting: Tags must be properly nested; a tag opened within another tag must
close before the outer tag.
Example:
Example:
<parent> <child> </parent> </child> (this is wrong way)
<parent> <child> </child > </parent > (this is correct way)
Attribute Quotation: Attribute values must be enclosed in quotation marks (single ' or
double " quotes are both valid).
No Overlapping Tags: XML does not allow overlapping tags, such as <a><b></a></b>.
Each tag must close in the order it was opened.
Valid Characters: XML can only contain valid Unicode characters. Special characters like
<, >, & must be represented as &lt;, &gt;, and &amp;, respectively.
Unique Attribute Names: Attributes within the same element must have unique names;
duplicate attributes are not allowed.

XML Element:
XML elements are the building blocks of an XML document, defined by tags and used to store
data. An element consists of an opening tag, content, and a closing tag.
<name> Bishal </name>. Elements can contain text, attributes, other nested elements, or be
empty.
Tags are used to define XML elements. They indicate the start and end of an element and are
enclosed within angle brackets (< >). <name> is starting tag, </name> is closing tag from above
<name> element.

The rules for creating XML elements are:


1. Every element must have a start (<element>) and end tag (</element>), unless it’s an
empty tag (e.g., <element />).
2. Use valid names for elements:
a. Element name should always start with a letter or underscore (_).
b. Names can contain letters, numbers, underscores, periods ( . ), and hyphens( – ).
c. Avoid space in element name, use camelCase or underscore instead.
3. XML elements are case sensitive. So, <item> and <Item> both are different element.
4. Avoid use of special characters (&, <, >, etc) on the element names.
5. Each attribute name within an element must be unique.
6. Attribute values must be enclosed inside single or double quotes.
7. The Elements must be properly nested.
Example:
<parent> <child> </parent> </child> (this is wrong way)
<parent> <child> </child > </parent > (this is correct way)

--Made by Bishal Bhat-- 2


XML attributes:
XML attributes are name-value pair, used to provide additional information about an element.
They are placed inside the opening tag of an element. Name of all attributes within the same
element must be unique and their values must be enclosed within single or double quotes.

Attributes are best suited for meta-data (language, version, type), flags (active), and other small
descriptors (role, src, alt).

We should avoid the use of Attributes and use child elements because of the following reasons.
1. Attributes cannot hold complex or nested data. While, child elements can.
2. Overusing attributes can reduce the readability of the document.
3. Attributes provide limited flexibility. Changing attributes values in future is hard.
4. Attributes cannot describe the structure but child elements can.

Comments in XML:
Comments in XML are used to include notes or explanations within the code, which are ignored
by XML parsers. The syntax of XML comment is given as:
<! – – this is comment Text….. – – >

The rules for writing comments in XML are:


1. Comment Must be enclosed within <! – – and – – > .
2. “– –“ is not allowed inside the comment. Doing so will cause an error.
3. The comment cannot start or end with “ – “. Doing so will cause an error.
4. Comment nesting is not allowed.
5. Comments should not be placed inside tag names and attribute values.

XML document Structure:


<?xml version="1.0" encoding="UTF-8"?>
<rootElement>
<childElement1> </childElement>
<childElement2>
<name> </name>
</childElement>
</rootElement>

The first line of code is called XML declaration. We should always write this first line in all XML
documents. Version and encoding are the attributes that says we are using XML version 1.0 and
utf-8 encoding technique.
<rootElement> is the root element of the XML document. There is only one root element in
whole XML document. We can do nesting of elements as well as shown above.

XML Tree Structure:


The XML tree structure is a hierarchical model that represents the relationships between
elements in an XML document, similar to a family tree. Each element in XML is considered a
node in this tree structure, and nodes have parent-child relationships.

--Made by Bishal Bhat-- 3


The components of XML Tree Structure are:
1. Root Element: The root element Is the top element in the XML document and contains all
other elements. It is the “parent” of all other nodes. An XML document can have only
one root element.
2. Parent Element: The element that contains nested elements is called parent element of
all those nested elements.
3. Child Element: The elements nested inside parent element are called child elements of
that parent element. Child elements can also have nested element inside them. So, a
child element can also be a parent element of those elements.
4. Sibling Elements: The elements that share same parent are called sibling elements.
5. Attributes: Attributes provide additional information about elements but are not part of
the tree structure. They are considered properties of elements rather than notes
themselves.

Given below is XML code and its tree structure.

XML code: XML Tree Structure:


<college>
<student>
<fname>Bishal</fname>
<lname>Bhat</lname>
<contact>98064...</contact>
<address>
<province>Far-Western</province>
<district>Kanchanpur</district>
</address>
</student>
</college>

XML namespace:
XML namespaces are a way to avoid element name conflicts in XML documents, especially when
combining elements from multiple XML vocabularies (I.e. elements from different schemas or
applications). A XML namespace is defined within the opening tag of an element using “xmlns”
attribute with a specific prefix. The value of this attribute is URI.
Syntax:
<rootElement xmlns:prefix = “https://example.com/prefix” >
…..
</rootElement>

The xmlns stands for XML namespace. The xmlspace is used to declare namespace. Prefix acts as
label for the namespace provided by the URI. This prefix is used before the element names to
indicate they belong to the specified namespace. “https://example.com/prefix” is a namespace
URI. For each namespace, this link and prefix should be unique.

The Benefits of using XML namespaces are:


1. It helps in avoiding element name conflicts.
2. Namespace make it easier to combine XML data from multiple XML documents into
single document.

--Made by Bishal Bhat-- 4


3. It improves XML readability.
4. It helps in document validation process.
5. It increases the flexibility of XML document.

Example:
Consider we have following XML tables. One is HTML table, and another is furniture table.

When, we try to combine these 2 tables within one XML document, name conflict arises. This
name conflict can be resolved using namespace as.

<rootElement>
<h:table xmlns:h="http://www.example.com/fruits">
<h:tr>
<h:td>Apples</h:td>
<h:td>Bananas</h:td>
</h:tr>
</h:table>

<f:table xmlns:f="https://www.example.com/furniture ">


<f:name>African Coffee Table</f:name>
<f:width>80</f:width>
<f:length>120</f:length>
</f:table>
</rootElement>

Note:
Mathi ko example chai resolution of name conflict when combining 2 elements in one XML
document ko ho, if exam ma namespace and example matra aaye, first ma definition lekhne and
then HTML ko fruit list wala table ko code lekhnu and tyo table ko XML equivalent code
lekhdinu.. XML code chai yei mathi ko example dekhi lekhnu, tesko lagi: furniture wala code (5
lines) lai xodera sabai lekhnu….

Q. What do you mean by Well-formed XML document?


An XML document with correct syntax is called well formed. I’am referring to the syntax we
discussed in the previous pages. Syntax of root element, elements, attributes, comments, etc.

Q. What do you mean by Valid XML document?


An XML document validated against a DTD or XML schema is called valid XML document. That
mean, Valid XML document follow DTD or XML schema. All valid XML documents are well
formed but all well-formed XML document may not be valid

--Made by Bishal Bhat-- 5


Document Type Definition (DTD):
A Document Type Definition (DTD) is a set of markup declarations that defines a structured
format for XML document. DTDs serve as a blueprint for XML documents, specifying the
elements, attributes, and their relationships. The purpose of DTD is to define structure of an
XML document. It defines the structure with a list of legal elements.

DTD example is given below:


<! DOCTYPE book [
<! ELEMENT book ( title, author, price)>
<! ELEMENT title (#PCDATA)>
<! ELEMENT author (#PCDATA)>
<! ELEMENT price (#PCDATA)>
]>

The DTD above is interpreted as:


1. “! DOCTYPE book” defines the root element of the document is “book”.
2. 2nd line means, the book element must contain the elements “title, author, price”.
3. “! ELEMENT title” defines the title element to be of type “#PCDATA”.
4. “! ELEMENT author” defines the author element to be of type “#PCDATA”.
5. “! ELEMENT price” defines the price element to be of type “#PCDATA”.
6. “#PCDATA” mean text data.

Note:
When we write elements name inside parentheses (2nd line), it mean the element must contain
specified elements as child. When we write ‘#PCDATA’ inside parentheses, it means that the
element will contain text data but not any element as its child. If we want to perform element
nesting on child elements also, then we have to write elements name instead of ‘#PCDATA’.
Generally, if any element doesn’t have any child elements, we will use #PCDATA inside its
parentheses.

There are 2 types of DTD. They are:


1. Internal / Embedded DTD
2. External DTD

Internal / Embedded DTD:


An internal DTD is defined within the XML document itself. It is useful for small documents or
when the DTD is specific to the particular XML document. The DTD declarations are done inside
<! DOCTYPE …> at the top of XML document. The example is given at the next page. It is not
reusable.

External DTD:
An External DTD is defined in a separate file, allowing it to be reused across multiple XML
documents. It is useful for larger projects or when the same structure needs to be applied to
multiple XML documents. The DTD is stored in a separate file with “.dtd” extension and is
referred in the XML document using “SYSTEM” or “PUBLIC” in the <! DOCTYPE …. > declaration.

DTD have many limitations such as lack of data types, no namespaces support, limited error
reporting, once element structure is defined; changing the structure is difficult especially in large
documents.

--Made by Bishal Bhat-- 6


Example of Internal DTD:
<?xml version="1.0" encoding=“utf-8”?>
<!DOCTYPE library [
<!ELEMENT library (book*)>
<!ELEMENT book (title, author, year, price)>
<!ELEMENT title (#PCDATA)>
<!ELEMENT author (#PCDATA)>
<!ELEMENT year (#PCDATA)>
<!ELEMENT price (#PCDATA)>
]>

<library>
<book>
<title>XML Basics</title>
<author>John Doe</author>
<year>2021</year>
<price>29.99</price>
</book>
</library>

Example of External DTD:


This block of code is External DTD. So, it is stored in a file named “library.dtd”.
<!ELEMENT library (book*)>
<!ELEMENT book (title, author, year, price)>
<!ELEMENT title (#PCDATA)>
<!ELEMENT author (#PCDATA)>
<!ELEMENT year (#PCDATA)>
<!ELEMENT price (#PCDATA)>

This block of code is written in “library.xml” file. And Here, the DTD file is referred in 2nd line
using SYSTEM “name_of_DTD_file”as.

<?xml version="1.0" encoding=“utf-8”?>


<!DOCTYPE library SYSTEM "library.dtd">
<library>
<book>
<title>XML Basics</title>
<author>John Doe</author>
<year>2021</year>
<price>29.99</price>
</book>
</library>

Note:
In <! ELEMENT library (book*)>, we have written asterisk (*). This means, that the library root
element can have 0 or more book elements.

--Made by Bishal Bhat-- 7


XML Schema:
XML Schema is commonly known as XML Schema Definition (XSD). It is used to describe and
validate the structure and content of XML data. It defines the elements, attributes, and data
types. It supports namespaces. It provides a flexible way to validate XML compared to DTDs. XSD
is an alternative to DTD. We write XML Schema code on ‘.xsd’ file.

The Simple data types are used to define elements that contains text values without any nested
elements. The most common simple data types are given as:
xs:string, xs:integer, xs:float, xs:boolean, xs:date, xs:time, xs:dateTime.

The complex Type is used to define elements that contains other elements or attributes. An
element that contains nested elements or attributes is of “complex type”
To define complex type element in XML Schema, we use:
<xs:element name = ‘elementName’>
<xs:complexType>
…..
</xs:complexType>
</xs:element>
To define simple data type element in XML, we use:
<xs:element name = ‘elementName’ type= “simpleDataType”/>

Example for XML Schema:


<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

<xs:element name="class"> <!-- Define the 'class' element -->


<xs:complexType>
<xs:sequence>
<xs:element name="student"> <!-- Define the 'student' element -->
<xs:complexType>
<xs:sequence>
<xs:element name="firstname" type="xs:string" />
<xs:element name="lastname" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType> XML code for above schema is :
</xs:element>

</xs:schema>

Note:
<xs:sequence> is used because we want everything in sequence.

--Made by Bishal Bhat-- 8


Extensible Stylesheet Language Transformations (XSLT):
XSLT is a language used to transform XML documents into different formats based on the
specified rules. The formats could be HTML, plain text, or another XML structure.

XML DOM:
The XML DOM is a standard for how to get, change, add, or delete XML elements. All XML
elements can be accessed through the XML DOM.

Example:
Consider in a Library, there are many books, with title and author. Write DTD + XML code and
XML Schema + XML code for it.
Ans:
The DTD and XML code are given as:
<?xml version="1.0" encoding="UTF-8"?>
<!- - DTD code - ->
<!DOCTYPE library [
<!ELEMENT library (book+)>
<!ELEMENT book (title, author)>
<!ELEMENT title (#PCDATA)>
<!ELEMENT author (#PCDATA)>
]>
<!- - XML code - ->
<library>
<book>
<title>DBMS </title>
<author >512 </author >
</book>
<book>
<title> DSA </title>
<author >600 </author >
</book>
</library>

The XML schema is given as:

<?xml version="1.0" encoding="UTF-8"?>


<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- Define the 'library' element -->
<xs:element name="library">
<xs:complexType>
<xs:sequence>
<!-- Define 'book' elements within 'library' -->
<xs:element name="book" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="title" type="xs:string"/>

--Made by Bishal Bhat-- 9


<xs:element name="author" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

The Xml code for above schema is:


<library>
<book>
<title>DBMS </title>
<author >512 </author >
</book>
<book>
<title> DSA </title>
<author >600 </author >
</book>
</library>

Note:
<xs:element name="book" maxOccurs="unbounded">
In this line from above XML Schema, we have written maxOccurs attribute, this attribute specifies
how many time the ‘book’ element should be made, when its value is set to “unbounded’ we can
make 0 or more “book” elements. The default value of this attribute is 1,
So, if we don’t write this attribute, then only one book element can be made. Making more than
one book element will show an error.

Example:
Write an XML file representing book information, including attributes like title, author, ISBN,
publisher, edition, and price with a DTD to validate the XML file.
(8 marks qn, 2074 year)
Ans:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE library [
<!ELEMENT library (book+)>
<!ELEMENT book (title, author, ISBN, publisher, edition, price)>
<!ELEMENT title (#PCDATA)>
<!ELEMENT author (#PCDATA)>
<!ELEMENT ISBN (#PCDATA)>
<!ELEMENT publisher (#PCDATA)>
<!ELEMENT edition (#PCDATA)>
<!ELEMENT price (#PCDATA)>
]>

<library>
<book>

--Made by Bishal Bhat-- 10


<title>DSA</title>
<author>Dinesh prasad Joshi</author>
<ISBN>978-0-123456-47-2</ISBN>
<publisher>Tech Books Publishing</publisher>
<edition>1st</edition>
<price>300</price>
</book>
<book>
<title>DBMS </title>
<author>Bishal Bhat </author>
<ISBN>978-0-987654-32-1</ISBN>
<publisher>Web world publications</publisher>
<edition>2nd</edition>
<price>600</price>
</book>
</library>

Example:
Create a XML document to store voter ID, name, address, and date of birth details. Also create
DTD to validate the XML document. (8 marks qn, 2075)
Ans:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE voters [
<!ELEMENT voters (voter+)>
<!ELEMENT voter (voterID, name, address, dateOfBirth)>
<!ELEMENT voterID (#PCDATA)>
<!ELEMENT name (#PCDATA)>
<!ELEMENT address (#PCDATA)>
<!ELEMENT dateOfBirth (#PCDATA)>
]>
<voters>
<voter>
<voterID>20021 </voterID>
<name>Bishal Bhat </name>
<address>Dodhara chandani</address>
<dateOfBirth>2002-12-17</dateOfBirth>
</voter>
<voter>
<voterID>20022 </voterID>
<name>Sara Ali Khan </name>
<address>Dodhara chandani </address>
<dateOfBirth>2000-4-2</dateOfBirth>
</voter>
</voters>

--Made by Bishal Bhat-- 11


Example:
Describe XML Schema Structure. Explain XSD order indicator and occurrence indicator with
example. (12 marks, 2075)
Ans:
The XML schema structure is explained with the help of given example.

<?xml version="1.0" encoding="UTF-8"?>


<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

<xs:element name="class"> <!-- Define the 'class' element -->


<xs:complexType>
<xs:sequence>
<xs:element name="student"> <!-- Define the 'student' element -->
<xs:complexType>
<xs:sequence>
<xs:element name="firstname" type="xs:string" />
<xs:element name="lastname" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

Explaination:
The first line is XML is declaration which specifies the version of XML is being used and what
character encoding is being used. The second line <xs:schema> is the root element of XML
schema, which declares XML schema namespace, allowing the use of schema-specific elements
prefixed with xs (like xs:element, xs:complexType, etc.)
<xs:element> allows us to define a new element. <xs:complexType> means the element is of
complex type. <xs:sequence> means we want the child elements in sequence. <xs:string> refers
to simple data type.

Order Indicator:
Order indicator defines the sequence in which child elements should appear in the XML
document. The most common order indicator is <xs:sequence>.
Example:
<xs:element type = “person”>
<xs:complexType>
<xs:sequence>
<xs:element name= ‘firstName’ type=‘xs:string’ />
<xs:element name= ‘lastName’ type=‘xs:string’ />
</xs:sequence>
</xs:complexType>
</xs:element>

--Made by Bishal Bhat-- 12


Occurrence Indicators:
Occurrence indicators control how many times an element can appear in the XML document.
The most common occurrence indicators are “minOccurs” and “maxOccurs”.
Example:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

<xs:element name="class">
<xs:complexType>
<xs:sequence>
<xs:element name="student" maxOccurs="3">
<!-- A maximum of 3 student elements -->
<xs:complexType>
<xs:sequence>
<xs:element name="firstname" type="xs:string" />
<xs:element name="lastname" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

Example:
Generate XML and XML schema. Class is a root Element, class has a child element Student,
student has 3 child elements: fname, lname, and age. The data types of fname and lname is
string and age is int. (12 marks, 2078)
Ans:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

<xs:element name="class"> <!-- Root element -->


<xs:complexType>
<xs:sequence>
<xs:element name="student" maxOccurs="unbounded">
<!-- Can have multiple students -->
<xs:complexType>
<xs:sequence>
<xs:element name="fname" type="xs:string" />
<xs:element name="lname" type="xs:string" />
<xs:element name="age" type="xs:int" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>

--Made by Bishal Bhat-- 13


</xs:element>
</xs:schema>

The XML code for above schema is given as:


<class>
<student>
<fname>Bishal </fname>
<lname>Bhat </lname>
<age>22</age>
</student>
<student>
<fname>Jethalal </fname>
<lname>Ggada</lname>
<age>25</age>
</student>
</class>

Example:
Write an XML schema to describe “address” as an element and “city, state, street, and house
no” as its attributes. Write XML code also. (12 marks, 2079)
Ans:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="address"> <!-- Address element -->
<xs:complexType>
<xs:attribute name="city" type="xs:string"/>
<xs:attribute name="state" type="xs:string"/>
<xs:attribute name="street" type="xs:string"/>
<xs:attribute name="houseNo" type="xs:string"/>
</xs:complexType>
</xs:element>
</xs:schema>

The Xml code is Given as:


<address city="New York" state="NY" street="5th Avenue " houseNo="101"/>

Note:
Previouly we use <xs:element name= “elementName” type= “dataType”/>. Here, used
<xs:attribute name="state" type="xs:string"/> are same as element ones.

--Made by Bishal Bhat-- 14


Example:
Write XML schema to describe info keeping student_info as root element, with child elements
name, age and semester. The data type should be string, integer and string respectively. The
element should be in sequence. Also write XML code for this schema. (12 marks, 2080)
Ans:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="student_info"> <!-- Root element -->
<xs:complexType>
<xs:sequence>
<xs:element name="name" type="xs:string"/>
<xs:element name="age" type="xs:int"/>
<xs:element name="semester" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

The XML code is given as:


<student_info>
<name>Bishal Bhat </name>
<age>22</age>
<semester>5th</semester>
</student_info>

***

--Made by Bishal Bhat-- 15

You might also like