👤🌐 EN

← ict

Unit II: Code Writing

Grade 12 Ict (new curriculum) p.106

Identify a data management problem which can be addressed by designing a database
solution.
Hints: You may work on a patient record management system, a farmer record
management system, a school’s record management system, a business customer
management system, a library management system, a hotel management system or
any other problem in your surrounding that can be addressed through the design and
implementation of database system.
Instructions:
A. Analyze the problem you want to work on and identify three to five objects or
entities about which you want to maintain data.
Hint: Patient, Physician, Treatment, etc if you work on patient management system
in Clinic; Guest, BedRooms, CheckIn, etc if you work on hotel management system.
B. Design the database structure.
Hint: Develop the ERD (Entity Relationship Diagram), identify attributes, and
create link (when appropriate).
C. Create the database and tables in it.
Hint: You may find informative name for your database from the problem you
considered. E.g. ‘PatientRecordDatabase’, ‘BookManagmentDatabase’.
D. Review your tables and modify tables, fields, data type, or table link with other
tables if needed. Hint: Use ALTER command.
E. Add three to five records in each table that have been created so far.
Hint: Use INSERT INTO command to add new records in a table.
F. Update at least two records in one of your tables.
Hint: Use UPDATE command to update records in a table.
G. Write five queries based on the following criteria.
● Select all records (e.g. select all patients, or doctors).
● Select records based on a single criterion
Hint: WHERE patientAdmitedDate earlier than January 1, 2022
● Select records based on multiple records.
● Hint: WHERE physicianAge < 45 AND Salary = 7000
99 I nformatIon t echnology g rade 12 ~ S tudent t extbook
UNIT
WEB AUTHORING
Learning Outcomes
At the end of this unit, students will be able to:
„ Explain how to use an extensible markup language(XML)
„ Analyse an XML document
„ Describe basic XML tags
„ Apply the syntax rules of XML documents
„ Create simple XML documents
„ Compare and contrast hypertext markup language(HTML) vs. XML
„ Understand how to publish a website
Unit Overview
HTML, which stands for Hyper Text Markup Language, is the standard markup
language for creating web pages. HTML consists of a series of elements that are
used to describe the structure of a web page, such as <html>, <head>, <title>,
<body>, <table>, <image>,<a>, etc. These elements tell the browser how to
structure and display the content. This means, the HTML elements label pieces
of content such as “My Heading”, “Paragraph starts here”, “Link to about page”,
etc. You have learned the basics of HTML and web design in Web Authoring in
Grade 11 IT subject.
This unit introduces another widely applicable markup language called XML.
The unit covers an overview of XML, its structure, and the differences between
XML and HTML. Finally, website publishing is discussed.
100 I nformatIon t echnology g rade 12 ~ S tudent t extbook
Web Authoring
UNIT-4
4.1. Introduction to XML
Brainstorming 4.1
„ What comes to your mind when you hear the term ‘markup language’?
The eXtensible Markup Language (XML) is a markup language like HTML. A
markup language is a computer language that uses tags enclosed with less than (<)
and greater than (>) symbols to define elements within a document. When the file
is processed by a suitable application, the tags are used to control the structure or
presentation of the data contained in the file. Any text that appears within one of
these tags is considered part of the markup language. Markup files contain standard
words, rather than typical programming syntax.
Activity 4.1
• Describe one fact about XML.
XML is a way of applying structure to a web page. XML provides a standard open
format and mechanisms for structuring a document so that it can be exchanged
and manipulated. XML complements your HTML knowledge by allowing you to
structure your data by marking up the text and data to define the data content.
XML is used for storing structured data, rather than formatting information on a
page. While HTML documents use predefined tags (such as “ <head>”, “<title> ”
), XML files use custom tags to define elements.
Microsoft Rich Text Format (RTF), Adobe Portable Document Format (PDF), and
HTML are types of markup languages that provide presentational markup. They
are powerful solutions to the problem of displaying information. Their common
limitation is that they describe how the data looks, but they do not give any
information about what it is.
Like HTML, XML uses tags to “mark-up” data content. Unlike HTML, in XML
you define your own tags that meet the exact needs of your document. The custom
101 I nformatIon t echnology g rade 12 ~ S tudent t extbook

4.1.1 Elements of XML Documents p.109

Web Authoring
UNIT-4
tags make your data easier to organize and more searchable. For example, a student
might describe the book she reads on vacation time like this:
<books>
<book>
<title>An Introduction to XML and Web Technologies </title>
<author> by Anders Moller, Michael Schwartzbach</author>
<type>Programming Languages</type>
</book>
</books>
XML does not change the way your web pages looks; instead, it changes the way
the documents are read and filed and stored. Therefore, XML is used to describe
the structure of a document rather than the way it is presented.
The two areas in which XML is useful are structuring data for storage, where a
relational database (See Unit Three about database) is inappropriate, and the
presentation of web pages. For example, a system is handling small quantities of
data, or if the data lacks a relational structure, programmers usually prefer to create
their own data formats, i.e. XML.
Activity 4.2
1. What tags are used by XML? How are they different from tags used in
HTML?
2. Can HTML replaces XML? Explain your reason.
3. Describe two areas where XML is important.
XML document must contain one root element that is the parent of all other elements,
for example “<people>” in Figure 4.1). The best way to learn what makes up an
XML document is by starting from a simple example. The following is a complete
XML document that lists the names of two known athletes.
102 I nformatIon t echnology g rade 12 ~ S tudent t extbook
Web Authoring
UNIT-4
XML document structure Example of an XML document
<?xml version=”1.0” encoding=”UTF-8”?> <people>
<!DOCTYPE people[ <person>
<!ELEMENT people (person+)> <name>
<!ELEMENT person (name)> <first>Haile </first>
<!ELEMENT name (first, last)> <last>Gebrselassie</last>
<!ELEMENT first (#PCDATA)>
</name>
<!ELEMENT last (#PCDATA)>
</person>
<person>
<name>
<first>Derartu</first>
<last>Tulu</last>
</name>
</person>
</people>
Figure 4. 1 XML Document Structure (left) and Example (right)
The above XML lets you name parts of the document such as the first names and
the last names of two of our legendary athletes. You can name anything that is
relevant to the document you want to produce. All that matters is that you follow
the basic rules for creating tags. The above markup does not follow the basic rules
(predefined tags), rather you define your tags. Figure 4.2 highlights the various
elements of the sample document.
103 I nformatIon t echnology g rade 12 ~ S tudent t extbook
Web Authoring
UNIT-4
Figure 4. 2 Various Elements of the XML document
The numbers shown in Figure 4.2 are interpreted as follows:
1. XML declaration: describes the general characteristics of the document,
such as XML document, the version of the XML, and the encoding character
it uses. XML documents usually begin with the XML declaration statement
called the processing instructions which provide information on how the XML
file should be processed. E.g. <?XML version= “1.0” encoding=“UTF-8”?>
The processing instruction statement uses the encoding property to specify
the encoding scheme used to create the XML file. Encoding is the process
of converting Unicode character into their binary equivalent representation
depending on the type of encoding(‘UTF-8’ or ‘UTF-16’).
2. Document Type Declaration (DTD): describes the structure of the document
in terms of which elements it may contain, along with any restrictions it may
have. In other words, it describes the root. The above example is about people.
The document ‘people’ is described with five elements. These are described
below.
E.g. <!DOCTYPE people […]>
3. Internal DTD subset: a DTD is internal if the elements are declared within the
same XML file. In the following example, internal declarations that are local to
the XML document are used.
<!ELEMENT people (person+)>
<!ELEMENT person (name)>
<!ELEMENT name (first, last)>
104 I nformatIon t echnology g rade 12 ~ S tudent t extbook
Web Authoring
UNIT-4
<!ELEMENT first(#PCDATA)>
<!ELEMENT last(#PCDATA)>
Notes
„ PCDATA – stands for Parsed Character DATA. Character data is a
text that is found between the start tag and the end tag of an XML
element. E.g. Abebech in Figure 4.2.
4. XML information set or Content: this represents the XML document’s
content—the information that the document conveys. Content refers to the
information that is represented by the elements of an XML document. See the
example in Figure 4.3.
<people>
<person>
<name>
<first>Abebech</first>
<last>Kebede</last>
</name
</person>
<person>
<name>
<first>Jemal</first>
<last>Ahmed</last>
</name>
</person>
</people>
Figure 4. 3 XML document content.
5. Root element: This encloses all of the information. An XML document can
have only one root element. Therefore, “<people>” is the root of this XML
document.
6. Start tag: XML elements have a start and an end tag—the start tag provides
the name of the XML element. E.g. <first>
7. End tag: The name of the end tag must exactly match the name of the start
tag.
105 I nformatIon t echnology g rade 12 ~ S tudent t extbook

4.1.1 Elements of XML Documents p.113

Web Authoring
UNIT-4
E.g. <people> with </people>, <person> with </person>, <first> with </first>
8. XML element: The start and the end tags are collectively referred to as an
XML elements. Elements are the basic units that are used to identify and
describe the data in XML. They are the building blocks of an XML document.
E.g. <last>Kebede</last>
9. Data: XML elements can contain data between the start and the end tags. An
XML document represents information using a hierarchy. That means, it begins
with a root element (e.g. people), which contains sub-elements (e.g. person)
which in turn can contain other sub-elements(e.g. name), data (e.g. Kebede), or
both. E.g. Abebech, Kebede, Jemal, and Ahmed are data.
Besides the above elements, attributes and comments are also part of XML
documents.
Attribute: Like HTML, XML elements can contain attributes. An attribute provides
additional information about the elements for which it is declared. It consists of a
name-value pair. In the following example, the attribute name is personid and the
value is “101”. The attribute value should be quoted: single or double quotes can
be used.
E.g. <name personid = “101”>Ubang </name>
Comment: This is a kind of note or statement that is used to describe the XML
code. Comments can provide documentation information about the XML file or the
application to which the file belongs. A comment is ignored by the XML parser(or
a program that interpretes XML instruction) during code execution.
The syntax for a comment is: <!-- This is a comment -->
We can see the whole hierarchy of the above markup in an upside-down tree struc-
ture, as shown in Figure 4.4.
106 I nformatIon t echnology g rade 12 ~ S tudent t extbook
Web Authoring
UNIT-4
Figure 4. 4 Tree Structure of Person XML document
Although XML is designed so that people can read it, it is not intended to create
a finished document. In other words, you can not open up just any XML-tagged
document in a browser and expect it to be formatted well. XML is meant to hold
content so that when the document is combined with other resources, such as a
style sheet which renders a web page, it becomes a finished product.
Activity 4.3
1. Describe elements of XML documents and their purposes.
2. Write XML that describes a food menu. Each type of food has a
description which contains the name of the food and its price. Save it as
test.xml.
Hint: root – food_menu, DTD – it is about food, content – food description
(name and price).

4.1.2 Creating XML Documents p.114

There are a few ways of opening an XML file directly. You can open and edit XML
files with any text editor, view them with any web browser, or use a website
that lets you view, edit, and even convert them to other formats. You can also use
107 I nformatIon t echnology g rade 12 ~ S tudent t extbook
Web Authoring
UNIT-4
applications such as “oxygen” or “XML Notepad” to see your files’ structures. In
this section, we use “XML Notepad” for our demonstration.
For example, after saving the XML code given above as an example with the *.xml
extension in any text editor, when you open the file with XML Notepad, it looks as
shown in Figure 4.5. It just does nothing because XML is just information wrapped
in tags. A piece of program should be written to send, receive, store, or display it.
When you view your XML document in a browser, most browsers display an
XML document with color-coded elements (See Figure 4.5 below comparing the
document Mozilla and Internet Explorer browsers). Often a plus (+) or minus (-)
sign to the left of the elements can be clicked to expand or collapse the element
structure. To view XML source code, try to select “View Page Source” or “View
Source” from the browser menu you use.
XML document on Mozilla XML document on Internet Explorer browser
browser
Figure 4. 5 XML Document on Browsers – Mozilla and Internet Explorer
Figure 4.6 below demonstrates a view of an XML document using XML Notepad
editor.
108 I nformatIon t echnology g rade 12 ~ S tudent t extbook
Web Authoring
UNIT-4
XML document viewed on XML Notepad – Tree View
Tree View on
XML Note-
pad
XML documents viewed on XML Notepad – XSL Output view
XSL Output
on XML
Notepad
Figure 4. 6 XML document view on XML Notepad
Notes
„ XSL is a style sheet for XML as CSS is a style sheet for HTML. XSL
transform and render XML document (See Figure 4.6 above).
109 I nformatIon t echnology g rade 12 ~ S tudent t extbook
Web Authoring
UNIT-4
Activity 4.4
1. Write the above XML on any text editor and save it as test.xml. Then
open the test.xml using at least two browsers and note what you have
observed.
2. Use the file created in Activity 4.3 Question 2 and open the test.xml
using XML Notepad editor and see the result – in Tree View and XSL
Output.
Hint: Don’t forget to add XML declaration statement at the
beginning.<?xml version=”1.0” encoding=”UTF-8”?>
Syntax rules to be remembered while working on XML:
1. You should have one root: XML documents must contain one element that is
the parent of all other elements.
A. <A><X> . . . </X><Y>…</Y></A></X> is wrong
because the root tag starts with <A> and ends with a different tag </X>
B. <A><X> . . . </X><Y>. . . </Y></A>is correct
because the root tag starts with <A> and ends with the same tag </A>
2. XML elements are case sensitive
A. <name>Ibrahim</Name> is wrong
B. <NAME>Ibrahim</Name> is wrong
C. <Name>Ibrahim</Name> is correct
3. All elements should not overlap, and they must properly be nested within each
other.
A. <Name><Student>Almaz</Name></Student> is wrong
B. <Student><Name>Almaz</Student></Name> is wrong
C. <Student><Name>Almaz</Name></Student> is correct
4. XML attribute values must always be quoted. The XML elements can have
attributes in name-value pairs which are similar to HTML.
<note date=”12/11/2007”>
<to>Gebre</to>
<from>Almaz</from>
</note>
5. Comments in XML: The syntax for writing comments in XML is similar to
that of HTML
E.g. <!-- This is a comment -->
110 I nformatIon t echnology g rade 12 ~ S tudent t extbook
Web Authoring
UNIT-4
6. XML does not truncate multiple white-spaces. In HTML, multiple white-spaces
are truncated to a single white-space.
XML HTML
Hello AbebechGobena Hello AbebechGobena
7. Entity References: In XML, some characters have special meaning. For
example, a character like “<” inside an XML element will generate an error.
This is because the XML parser interprets “<” as the start of a new XML
element. See the example below:
<Message>if salary <1000 then</Message> This generates an XML error:
To avoid this error, replace the “<” character with an entity reference as:
<Message>if salary &lt; 1000 then</Message> This is correct
There are 5 pre-defined entity references in XML. See these references in Table

4.1 below. p.118

Table 4. 1 Entity References in XML
&lt; < less than
&gt; > greater than
&amp; & ampersand
&apos; ‘ apostrophe
&quot; “ quotation mark
Notes
„ Only the characters “<” and “&” are strictly illegal in XML. The greater
than character is legal, but it is a good habit to replace it. Therefore,
XML documents that conform to the syntax rules above are said to be
“Well Formed” XML documents.
Activity 4.5
Examine the following XML code and rewrite it if the code is wrong.
XML code to analyze Corrected XML code
<note><to>Lucy</to><from>Hadar</note></from>
<student id=1010><name>Edossa</name></student>
<birth_date>Date of Birth</Birth_date>
<compare>10>5</compare>
<FullName> Robso Amanueal </fullname>
111 I nformatIon t echnology g rade 12 ~ S tudent t extbook
Web Authoring
UNIT-4
Element Declarations: XML documents consist of three things: elements,
entities, and control information. Elements are surrounded by tags like HTML.
The content of the document has a structure imposed by the rules of XML although
this structure is quite loose. Each document has a single root element that contains
all of the other markups. You have already learned this point in HTML where
all documents are enclosed inside <html></html> tags. The document is then
composed of several sections, each of which is enclosed between tags. The sections
themselves are also elements.
An XML element is everything from the start tag to the end tag’s of the element.
An element without content is said to be empty element. An empty element can be
described in one of the following options.
<element></element> <element />
Naming rules of XML elements:
• Element names are case-sensitive.
• Element names must start with a letter or underscore.
• Element names cannot start with the letters XML.
• Element names can contain letters, digits, hyphens, underscores, and
periods.
• Element names cannot contain spaces.
Any name can be used, but no words are reserved (except XML).
An element can contain: Example of XML
<Bookstore>
• Text
<Book category=”children”>
• Attributes
<title> Stories and Parables</title>
• Other Elements,
<author>Kebede Michael </author>
or
<year>2007</year>
• A mix of the
<price>Birr 150.00 </price>
above
</Book>
</Bookstore>
Figure 4. 7 XML Elements vs Examples
112 I nformatIon t echnology g rade 12 ~ S tudent t extbook
Web Authoring
UNIT-4
In the Figure 4.7 above,
• <title>, <author>, <year>, and <price> have text content because they
contain text. E.g. Kebede Michael.
• <Bookstore> and <Book> have element contents because they contain
elements.
• <Book> has an attribute. E.g. category=”children”.
Attribute Declarations: An XML element, like HTML, can have attributes. The
element’s attributes define data related to a specific element. Attributes provide
additional information about the element. An attribute is defined as key-value pair:
the key is the name (e.g. gender) and the attribute has values that must always be
quoted (e.g. “female”). Either single quotation marks (‘ ’) or double quotation
marks (“ ”) can be used. For example, a person element’s gender can be written
like this:
<person gender= “female”>or <person gender= ‘male’>
If the value of the attribute itself contains double quotation marks, use single
quotation marks, as shown in this example:
<person name= ‘Tilahun Gessesse “KomeLimerkish(ቆሜልመርቅሽ)”’ >
XML Elements vs. Attributes
<person gender=”female”> <person>
<firstname>Anna</firstname> <gender>female</gender>
<lastname>Smith</lastname> <firstname>Anna</firstname>
<lastname>Smith</lastname>
</person>
</person>
Figure 4. 8 XML Elements vs. Attributes
In the first example of Figure 4.8, gender is an attribute. In the next example,
gender is an element. Both examples provide the same information. There are no
rules about when to use attributes or elements in XML.
Entity Declarations: An entity is a declaration of a name that can be used in
an XML in place of content or markup. Entities must be declared before they are
used. All entities are declared with the “ENTITY” declaration. However, the exact
format of the declaration distinguishes between internal, external, and parameter
113 I nformatIon t echnology g rade 12 ~ S tudent t extbook
Web Authoring
UNIT-4
entities. The internal (parsed) entity declaration will be discussed for our purpose.
The purpose of internal parsed entities is generally to refer to text. It refers to data
that an XML processor has to parse.
Syntax for creating entity declaration Example
<!ENTITY name “value”> <!ENTITY publisher “Berhanena Selam Printing”>
Figure 4. 9 Entity Declaration
There are two parts to entities. The first is an entity declaration of a name that tie the
replacement content. The above example declares an entity of the name ‘publisher’.
The name ‘publisher’ is associated with the content of “Berhanena Selam Printing”.
The second is using the name defined in the entity declaration subsequently in the
XML as shown below. When the entity name is used in XML, it is called an entity
reference.
<author>Addis Alemayehu</author>
<pubinfo>Published by &publisher;</pubinfo>
When the parser subsequently encounters an ampersand symbol (i.e. &) and
semicolon (i.e. ;) which identify a general entity reference, the parser looks

4.1 below. p.121

up that name in an entity declaration table (See Figure 4.9). In our case, the
reference, &publisher; is replaced by the content that it represents. Using the
following (left column) XML, expanding the entity reference, and replacing the
&publisher; with the “Berhanena Selam Printing” content gives the following
expanded XML.
XML document with internal DTD
<<?xml version=”1.0”?>
<!DOCTYPE book [
<!ENTITY publisher “Berhanena Selam Printing”>
<book>
<author>Addis Alemayehu</author>
<pubinfo>Published by &publisher;</pubinfo>
</book>
114 I nformatIon t echnology g rade 12 ~ S tudent t extbook
Web Authoring
UNIT-4
Output on browser
Figure 4. 10 XML Document with DTD and Output on Browser
Document Type Definition (DTD)
A Document Type Definition (DTD) defines the structure attributes of a document
and the legal elements of an XML document. It can be used by an application
to verify that XML data is valid. A DTD declared inside the XML file must be
wrapped inside the <!DOCTYPE> definition. See Figure 4.11 below.
Example of an XML document with internal DTD
<?xml version=”1.0”?>
<!DOCTYPE album [
<!ELEMENT album (singer, name, release, language)>
<!ELEMENT singer (#PCDATA)>
<!ELEMENT name (#PCDATA)>
<!ELEMENT release (#PCDATA)>
<!ELEMENT language (#PCDATA)>
<album>
<singer>Ali Birra</singer>
<name>Ammalele</name>
<release>2012</release>
<language>Oromiffa</language>
</album>
115 I nformatIon t echnology g rade 12 ~ S tudent t extbook
Web Authoring
UNIT-4
The interpretation of the above DTD is:
• !DOCTYPE album - defines the root element of the document album
• !ELEMENT album - defines the album element which must contain
four elements: “singer, name, release, language”
• !ELEMENT singer - defines singer element type “#PCDATA”
• !ELEMENT name - defines name element type “#PCDATA”
• !ELEMENT release - defines release element type “#PCDATA”
• !ELEMENT language - defines language element type “#PCDATA”
• PCDATA - means parsed character data. Think of character data as
the text that is found between the start tag and the end tag of an XML
element.
Figure 4. 11 Document Type Definition
Activity 4.6
• Write DTD for the following XML and test the output on a browser.
<!ENTITY author “Author: Addis Ababa University.”>
<!ENTITY copyright “Copyright: Ministry of Education.”>
<textbook>&author;&copyright;</textbook>
4.2. HTML vs. XML
Brainstorming 4.2
„ Compare the features of HTML and XML.
HTML is the markup language that helps you to create and design web content.
It has a variety of tags and attributes for defining the layout and structure of the
web document. It is designed to display data in a formatted manner. An HTML
document has the extension .htm or .html.
116 I nformatIon t echnology g rade 12 ~ S tudent t extbook
Web Authoring
UNIT-4
XML is a markup language that is designed to store data. It is popularly used for
the transfer of data. It is case sensitive. XML offers you the ability to define markup
elements and generate customized markup language. The basic unit in XML is
known as an element, and the extension of an XML file is .xml
Table 4.2 Compares common features of HTML and XML.
Parameter XML HTML
Type of language XML is a framework for HTML is a predefined
specifying markup languages. markup language.
Structural details They are provided. They are not provided.
Purpose Transfer of data. Display / Presentation of
data
Nesting It Should be done appropriately. It does not have any effect
on the code.
Driven by XML is content driven. HTML is format driven.
Size Documents are mostly lengthy The syntax is very brief
in size, especially when an ele- and yields formatted text.
ment-centric approach is used in
formatting.
Learning curve It is very hard as you need to learn It is a simple technology
technologies like XPath, XML stack that is familiar to
Schema, DOM, etc. developers.
Coding Errors No coding errors are allowed. Small errors are ignored.
Extension .xml .html or .htm
E.G. Page1.xml E.G. Page1.html
Whitespace White spaces can be used in your White spaces cannot be
code. used in your code.
Output <Name> Motherland <p>Motherland
Ethiopia</Name> Ethiopia</p>
Motherland Ethiopia Motherland Ethiopia
117 I nformatIon t echnology g rade 12 ~ S tudent t extbook
Web Authoring
UNIT-4
Parameter XML HTML
Language type It is case sensitive. It is case insensitive.
<Name>Lucy</Name> <STRong>Lucy<strONG>
Tag Tags are defined as per the need It has its own predefined
of the programmer. tags.
E.G. <book><Author><Title> E.G. <body><b><i>
End of tags The closing tag is essential in a The closing tag is not
well-formed XML document. always required.
<Person><student><Name>Your <body><P> This is
name paragraph </body>
</Name</student>></Person>
Quotes Quotation marks are required Quotation marks are not
around XML attribute values. required for the values of
attributes.
<Department><number < b o d y
type=”int”> 101 </number></ bgcolor=#00ff00><p>
Department> This is paragraph </body>
Activity 4.7
• Discuss the similarities and differences between HTML and XML.
118 I nformatIon t echnology g rade 12 ~ S tudent t extbook

4.2.1 Advantages and Disadvantages of XML p.126

Web Authoring
UNIT-4
Some of the advantages and disadvantages of XML are listed below.
Table 4. 3 The Advantages and the Disadvantages of XML
Advantages of using XML Disadvantages of using XML
• XML makes documents • XML requires a processing
transportable across systems application
and applications. With
• The XML syntax is very
the help of XML, you can
similar to other alternative
exchange data quickly
‘text-based’ data transmission
between different platforms.
formats which are sometimes
• It separates the data from confusing
HTML.
• No intrinsic data type support
• It simplifies the platform
• The XML syntax is redundant
exchange process.
• It does not allow users to create
their tags.
Activity 4.8
• Discuss the advantages and disadvantages of XML with a partner.
4.3. Publishing Website
Brainstorming 4.3
„ What do you know about website publishing?
You have learned that the purpose of XML is for storing structured data, not
formatting or styling a document. That is why you see on top of the browser “This
XML file does not appear to have any style information associated with it”
when you open your XML document (See Figure 4.5 above).
119 I nformatIon t echnology g rade 12 ~ S tudent t extbook
Web Authoring
UNIT-4
XML is just information wrapped in tags. So it is now time to write a piece of
program to display our XML document. In the following discussion, you will learn
how you put all of the XML document, web designing, and publishing concepts that
you have learnt in Grade 11 together to develop further skills in website publishing.
Step-by-Step design of XML document and publishing
So far, it has been discussed that HTML tags are not understood by XML coding.
If that is the case, we can have our own customized tag names for the specific
environment rather than predefined HTML tags. Let us take a ‘college’ environment
and organize the contents of the college documents using an XML structure.
To start your coding, you should write an XML declaration statement at the
beginning to indicate that it is an XML language by using <? Xml version =”1.0”
encoding=”UTF-8”?>, as shown in the example below.
Instead of <html>, we can start our root to be <College>. This shows that the
initial data or root for our XML is going to be college:
XML document Code XML document view on XML Notepad
<?xml version =”1.0” encoding=”UTF-8”?>
<College><!-- Opening tag College-->
</College><!-- Closing tag College-->
Figure 4. 12 XML with custom tags
Save the above document with your name .xml (such as yourname.xml) and keep
updating the data and save your document after each step.
The next step is to organize the data of the college. Different colleges can have
different structures or organizations for their data. Here we organize the college
in terms of departments. The college can have several departments; in our case,
it has three departments. We create again an element named <Department> as a
sub-element of the <College>. The information may be organized as follows (See
Figure 4.13).
120 I nformatIon t echnology g rade 12 ~ S tudent t extbook
Web Authoring
UNIT-4
XML document Code XML document view on XML Notepad
<?xml version =”1.0”
encoding=”UTF-8” ?>
<!-- Opening tag Col-
lege-->
<College>
<Department>
</Department>
<Department>
</Department>
<Department>
</Department>
</College>
<!-- Closing tag
College-->
Figure 4.13 College structure with Departments
The departments in the college can have detail information. This may include
the department name and the department number (See Figure 4.14). Before
proceeding to other sub-elements of the department, we can fill in the content for
the department name and number. For further processing, you can attach data type
to your elements. If you see the first department as an example, the attribute or data
type for the department number is an integer value. Therefore, you have to think
about your values.
121 I nformatIon t echnology g rade 12 ~ S tudent t extbook
Web Authoring
UNIT-4
XML document Code XML document view on XML Notepad
<?xml version =”1.0” encod-
ing=”UTF-8” ?>
<!-- Opening tag College-->
<College>
<Department>
<Name> ICT </Name>
<Number type=”int”>101 </
Number>
</Department>
<Department>
<Name>Physics</Name>
<Number>102</Number>
</Department>
<Department>
<Name>Biology</Name>
<Number>103</Number>
</Department>
</College>
<!-- Closing tag College-->
Figure 4.14 College structure with Data Type Added
Not only the name and number of departments can be added but also details of
students, teachers, and courses. Each of these can also be created as sub-elements
of the department as shown below in Figure 4.15.
122 I nformatIon t echnology g rade 12 ~ S tudent t extbook
Web Authoring
UNIT-4
XML document view on XML Notepad
123 I nformatIon t echnology g rade 12 ~ S tudent t extbook
Web Authoring
UNIT-4
XML document
<?xml version =”1.0” encoding=”UTF-8” ?>
<College>
<Department>
<Name>Department Name: ICT </Name>
<dNumber type=”int”>Department Number: 101 </dNumber>

4.16 below). p.131

<Course>
<Name> Web Design </Name>
<Number type=”Code”> ICT1012 </Number>
<Credithour type=”Cr_Hr”> 4 </Credithour>
<Teacher>
<TName type=”Teacher”>Abebe</TName>
</Teacher>
</Course>
<Course>
<Name>Programing</Name>
<Number type=”Code”> ICT1212 </Number>
<Credithour type=”Cr_Hr”> 4 </Credithour>
<Teacher>
<TName type=”Teacher”>Ayele</TName>
<IDNO type=”IDNO”> ICT/2323/13 </IDNO>
</Teacher>
</Course>
<Student></Student>
</Department>
<Department>
<Name> Department Name: chemistry </Name>
<dNumber>Department Number: 102 </dNumber>
<Course>
<Name> Organic Chemistry </Name>
<Number type=”Code”> CHEM1212 </Number>
<Credithour type=”Cr_Hr”> 4 </Credithour>
</Course>
<Course>
<Name>Inorganic Chemistry</Name>
<Number type=”Code”> CHEM2121 </Number>
<Credithour type=”Cr_Hr”> 4 </Credithour>
</Course>
<Teacher></Teacher>
<Student></Student>
</Department>
</College>
Figure 4. 15 College Structure with Teachers’ and Students’ Data Added
124 I nformatIon t echnology g rade 12 ~ S tudent t extbook
Web Authoring
UNIT-4
Also, you can add teachers and students’ data by creating sub-elements such as
name, sex, age, etc.
Once you have designed your website, the next step is to publish it.
Until this point, you have learnt website design. Once you have completed the
design of your website, the next step involves publishing the website so that the
website is accessible worldwide by anyone.
Website publishing is the process of publishing the website’s original content onto
the Internet, or specifically onto a remote server. The term sometimes refers to
the whole process of website design and publishing. This includes building and
uploading websites, updating the webpages, and posting content to these webpages
online. Web publishing includes personal, business, and community websites. The
content meant for web publishing can include text, videos, digital images, artwork,
and other forms of media such as music.
The most common thing about any website is that it is represented by a root di-
rectory. A root directory contains folders to organize images(.jpg,.gif), style files(.
css), and script files(.js) that are used in the website, and its index file (See Figure
1. root: this is the top level or root folder that represents the website itself. It
contains all other files and folders of the website. For example, moe.gov.et.
2. index.html: contains the main homepages of the site which are written in
HTML. Web servers are by default set up to return to the index.html file if
no file name is specified. For example, if you write moe.gov.et, it returns to
moe.gov.et/index.html.
3. pages folder: this subfolder contains web pages of the site. For example:
about, contact us, etc. The name could be anything related to the site.
4. images folder: this is the subfolder that contains all the images that are
used on the site.
5. CSS folder: CSS code used to style the site resides in this folder. It includes,
for example setting text and background colors.
125 I nformatIon t echnology g rade 12 ~ S tudent t extbook
Web Authoring
UNIT-4
6. scripts folder: this subfolder contains all the JavaScript code used to add
interactive functionality to the site (e.g. buttons that load data when clicked).
Figure 4. 16 Sample website - directory and files organization
A website is published by uploading website content or files onto the remote
server which is provided by the hosting company or web host. Hosting companies
provide web hosting services, which means providing online space for the storage
of websites. A website is made available via World Wide Web (WWW). Web hosts
must possess a web server. The web server is the actual location where your website
resides. A web server may host single or multiple sites depending on what hosting
service you have paid for.
The process of publishing a website also involves registering a domain name. A
domain name is the part of your internet address that comes after “www”. For
example, in http://www.moe.gov.et/, the domain name is moe.gov. A domain name
becomes your online business address, so care should be taken when selecting a
domain name. Your domain name should be easy to remember and easy to type.
It must be unique. If the one you want to use is taken or not available, domain
registration fails, and you need to find another one.
A domain extension is made up of three letter (for example, .gov in the above
URL) at the end of the internet address which is known as a top-level domain
names. The most common domain extensions include:
126 I nformatIon t echnology g rade 12 ~ S tudent t extbook
Web Authoring
UNIT-4
• .com for commercial sites.
• .edu for educational institution.
• .gov for government institutions.
• .org for a non-profit organization.
• .mil for military.
• .net for network
Security options
To keep your site safe and secure, a secure URL is needed. Particularly, if the site
visitors are providing their private information, HTTPS is required, not HTTP.
HTTPS (Hypertext Transfer Protocol Secure) is a protocol that is used to provide
security over the Internet. To enable HTTPS, your website needs an SSL. SSL
stands for Secure Sockets Layer which provides a secure online connection, and

4.16 below). p.134

your website needs an SSL Certificate. SSL is also another necessary site protocol.
It ensures your site visitor’s personal information transfers between the website
and your database are secure. SSL encrypts information (send from you/receive
from the server) to prevent others from accessing and reading it while in transit.
To check whether a website is secure or not, you can type the website name into
a browser address bar (e.g. ethiopia.gov.et) and notice one of the two results as
shown below. A secure site displays a locked keypad (See the image in the second
column below). If the site is not secure, before the web address, you could see the
information icon and ‘Not secure’ (see the image in the first column below).
Non secure website is shown on a browser Secure website is shown on a browser
address bar address bar
127 I nformatIon t echnology g rade 12 ~ S tudent t extbook
Web Authoring
UNIT-4
Activity 4.9
1. Based on the below website directory:
a. What is the name of the website?
b. Identify the root directory and sub-directory, image directory, style
directory, home page, or index page.
2. Take the websites of five Ethiopian federal institutions and check if their
websites are secured. Hint: moa.gov.et, mofed.gov.et, etc.
3. Review at least two web hosting companies in Ethiopia, with features provided.
128 I nformatIon t echnology g rade 12 ~ S tudent t extbook
Web Authoring
UNIT-4
Unit Summary
In this unit, you have learnt about:
• the markup language XML.
• the definition of XML, its features, and purpose.
• elements of XML.
• XML vs. HTML – similarities and differences.
• advantages and disadvantages of XML.
• XML tags, root, XML declaration.
• document Type Declaration (DTD), Attributes, Comments.
• ways of opening XML file directly.
• entity references and entity declaration.
129 I nformatIon t echnology g rade 12 ~ S tudent t extbook
Web Authoring
UNIT-4
Web Authoring
UNIT-4
Key Terms
A markKuepy l aTnegrumagse is a type of computer language that uses tags such as
“<” and “>” to define elements in a document.
A markup language is a type of computer language that uses tags such as
X“<M” Lan d s “ta>n”d tso fdoerfi Enex teelnesmibelnet sM ina ark duopc uLmanengtu.age which is a way to apply
structure to a web page. XML provides a standard open format and mechanisms
XML stands for Extensible Markup Language which is a way to apply
for structuring a document so that it can be exchanged and manipulated.
structure to a web page. XML provides a standard open format and mechanisms
Afonr sXtrMucLtu rdinogc uam deoncut mcoenntta sion st htahte i tf ocallno wbein egx:c XhaMngLe dd eacnlda rmataionnip, uDlaotecdu.ment
Type Declaration (DTD), Internal DTD subset, XML information set /
An XML document contains the following: XML declaration, Document
Content, Root element, Tags, Data, Attributes, and Comments.
Type Declaration (DTD), Internal DTD subset, XML information set /
PCooinnttesn tto, Rreomoet melbemere wnth, iTlea gyso,u D waotar,k A otntr iXbMuteLs:, and Comments.
Po• intsY toou r eshmoeumldb hera vweh oilnee y roouo tw ino rakn o Xn MXLM dLo: cument.
•• XYoMuL s heoleumlde hnatsv ea roen cea sroe-oste inns iatniv Xe.M L document.
•• XXMMLL sehleomuledn ntso at roev cearlsaep-s oern asiltli evlee.m ents must properly be nested within
each other.
• XML should not overlap or all elements must properly be nested within
• XeaMchL o athtterirb.ute values must always be in quotation marks.
•• CXoMmLm aettnrtisb uinte X vMalLue fso mllouwst tahlew HayTsM beL icno qmumoteantito snt rmucatrukrse..
•• XCoMmLm deonetss nino tX trMunLc faotell omwu ltthipel He wTMhitLe scpoamcemse.nt structure.
•• SXpMecLi adlo cehsa nraoct tterrusn nceaeted menutlittiyp lree fwerheintecsepsa, coeths.erwise, they create errors.
H•T MSLp aencida lX cMhaLra catreer tsw noe eddiff eenrteitnyt rmefaerrkeunpc elasn, gouthaegrews.i sHeT, tMheLy icsr tehaet em earrrkoursp.
language to design and create web content, whereas XML is a markup
HTML and XML are two different markup languages. HTML is the markup
language designed to store data. It is popularly used for the transfer of data.
language to design and create web content, whereas XML is a markup
However, the two complement each other.
language designed to store data. It is popularly used for the transfer of data.
EHnowtiteyv eRr,e tfheer etnwcoe sc:o Tmhpilse mreefenrts e atoc hc hoathraecr.ters that have special meaning in
XML. There are 5 pre-defined entity references in XML, such as &lt; (<),
Entity References: This refers to characters that have special meaning in
&gt; (>), &amp; (&), &apos; (‘), and &quot; (“).
XML. There are 5 pre-defined entity references in XML, such as &lt; (<),
Y&ogut; c(a>n) , o&paemn pan; d(& e)d,i &t XapMoLs; w(‘i)t,h aanndy &teqxuto etd; i(t“o)r., and view it with any web
browser, or use a website that lets you view, edit, and even convert it to other

4.16 below). p.137

You can open and edit XML with any text editor, and view it with any web
formats.
browser, or use a website that lets you view, edit, and even convert it to other
Ifno rDmTatDs. the !DOCTYPE - defines the root element of the document.
In DTD the !DOCTYPE - defines the root element of the document.
130 I nformatIon t echnology g rade 12 ~ S tudent t extbook
130 I nformatIon t echnology g rade 12 ~ S tudent t extbook
Web Authoring
UNIT-4
PCDATA in<!ELEMENT releases (#PCDATA)>- means parsed character
data.
Advantages of using XML: It makes documents transportaWWbleeebb, AAseuuptthharooarrtiiennsgg
UNIT-4
data from HTML, flexible platform change process.
Disadvantages of using XML: It requires a processing application, syntax
PCDATA in<!ELEMENT releases (#PCDATA)>- means parsed character
sometimes confusing, no intrinsic data type, and redundant syntax.
data.
Website publishing is the process of publishing the website’s original content
Advantages of using XML: It makes documents transportable, separates
on the Internet, or specifically on a remote server.
data from HTML, flflexible platform change proces.
Websites are published by uploading website content/files onto the remote
Disadvantages of using XML: It requires a procesing aplication, syntax
server which is provided by a hosting company or a web host.
sometimes confusing, no intrinsic data type, and redundant syntax.
SSL and HTTPS are protocols that provide security options that keep your
Website publishing is the proces of publishing the website’s original content
site safe and secure. HTTPS is secured and prevents interceptions and
on the Internet, or specifificaly on a remote server.
interruptions from occurring while the content is in transit. The website
Websites are published by uploading website content/fifiles onto the remote
requires an SSL certificate to enable HTTPS.
server which is provided by a hosting company or a web host.
SL and HTPS are protocols that provide security options that kep your
site safe and secure. HTPS is secured and prevents interceptions and
interuptions from ocuring while the content is in transit. The website
requires an SL certifificate to enable HTPS.
131 I nformatIon t echnology g rade 12 ~ S tudent t extbook
131 I nformatIon t echnology g rade 12 ~ S tudent t extbok
Web Authoring
UNIT-4
Review Questions
Part I: Match the items given under column B with associated items in
column A
A B
1. XML declaration A. <body>
2. HTML tag B. Extension of XML document
3. *.xml C. Secured website
D. <DOCTYPE … [ … ]>
4. https://www.moa.gov.et
E. <?xml version =”1.0”
5. XML attribute
encoding=”UTF-8” ?>
F. html
G. <student id=’101’></student>
H. <element/>

← መጻሕፍት