Integrative Programming and Technologies: Chapter Two
Integrative Programming and Technologies: Chapter Two
Mr. Husen Adem, Tutor, Ambo University || Woliso Campus, Ethiopia TREY 2
research
Data Exchange
Data exchange is the process of taking data structured under a source schema and actually
transforming it into data structured under a target schema, so that the target data is an accurate
representation of the source data.
Example
Standard Interchange Format for geospatial data, Data Interchange Format for spreadsheet data, Quicken
Interchange Format for financial data etc.
Data Exchange Language
The term is also applied to any file format that can be read by more than one program, including proprietary
formats such as Microsoft Office documents.
Example
Resource Description Framework (RDF), JSON (JavaScript Object Notation), Rebol, YAML, Gellish, XML
Mr. Husen Adem, Tutor, Ambo University || Woliso Campus, Ethiopia TREY 3
research
Metadata
Metadata (meta content) is defined as the data providing information about one or
more aspects of the data, such as:
Means of creation of the data
Purpose of the data
Time and date of creation
Creator or author of the data
Location on a computer network where the data were created.
Example
Digital image may include metadata that describe the picture size, the color depth, the image
resolution, time and date of image creation.
A text document's metadata may contain information about how long the document is, who the
author is, when the document was written, and a short summary of the document.
Mr. Husen Adem, Tutor, Ambo University || Woliso Campus, Ethiopia TREY 4
research
Introduction to XML
XML stands for Extensible Markup Language
XML is a markup language much like HTML
XML was designed to describe data, not to display data
XML tags are not predefined. You must define your own tags
XML is designed to be self-descriptive
XML is a W3C Recommendation
XML does not DO anything
Difference between XML and HTML
XML is not a replacement for HTML; XML is a complement to HTML.
XML is a software- and hardware-independent tool for carrying information.
XML was designed to describe data, with focus on what data is
HTML was designed to display data, with focus on how data looks
Mr. Husen Adem, Tutor, Ambo University || Woliso Campus, Ethiopia TREY 5
research
Introduction to XML
How Can XML be used?
XML is used in many aspects of web development, often to simplify data storage and sharing.
XML Separates Data from HTML
XML Simplifies Data Sharing
XML Simplifies Data Transport
XML Simplifies Platform Changes
Internet Languages Written in XML
Several Internet languages are written in XML. Here are some examples: XHTML, XML Schema,
SVG, WSDL and RSS
Mr. Husen Adem, Tutor, Ambo University || Woliso Campus, Ethiopia TREY 6
research
XMLTree
XML Documents Form a Tree Structure
XML documents must contain a root element. This element is "the parent" of all other elements.
The elements in an XML document form a document tree. The tree starts at the root and branches to
the lowest level of the tree.
All elements can have sub elements (child elements):
<root>
<child>
<sub child>......</sub child>
</child>
</root>
The terms parent, child, and sibling are used to describe the relationships between elements.
Parent elements have children. Children on the same level are called siblings (brothers or sisters).
All elements can have text content and attributes (just like in HTML).
Mr. Husen Adem, Tutor, Ambo University || Woliso Campus, Ethiopia TREY 7
research
XMLTree
XML Naming Rules
XML elements must follow these naming rules:
Names can contain letters, numbers, and other characters
Names cannot start with a number or punctuation character
Names cannot start with the letter’s xml (or XML, or Xml, etc)
Names cannot contain spaces
Any name can be used, no words are reserved.
XML Attributes
Mr. Husen Adem, Tutor, Ambo University || Woliso Campus, Ethiopia TREY 8
research
XMLTree
The image above represents one book in the XML below:
<bookstore>
<book category="COOKING">
<title lang="en">Everyday Ethiopian</title>
<author>Gada Waktolo</author>
<year>2011</year>
<price>90.00 birr</price>
</book>
<book category="Programming Language"> The root element in the example is <bookstore>.
<title lang="en">XML</title> All <book> elements in the document are
<author>Dr.Tola Bariso </author>
contained within <bookstore>.
<year>2010</year>
<price>150.00 birr</price> The <book> element has 4 children: <title>,
</book> <author>, <year>, <price>.
</bookstore>
Mr. Husen Adem, Tutor, Ambo University || Woliso Campus, Ethiopia TREY 9
research
XML Syntax Rules
1. All XML Elements Must Have a Closing Tag
In HTML, some elements do not have to have a closing tag:
<p>This is a paragraph.
<br>
In XML, it is illegal to omit the closing tag. All elements must have a closing tag:
<p>This is a paragraph. </p>
<br />
2. XML Tags are Case Sensitive
XML tags are case sensitive. The tag <Letter> is different from the tag <letter>.
Opening and closing tags must be written with the same case:
<Message>This is incorrect</message>
<message>This is correct</message>
Mr. Husen Adem, Tutor, Ambo University || Woliso Campus, Ethiopia TREY 10
research
XML Syntax Rules
3. XML Elements Must be Properly Nested
In HTML, you might see improperly nested elements:
<b><i>This text is bold and italic</b></i>
In XML, all elements must be properly nested within each other:
<b><i>This text is bold and italic</i></b> In the example above, "Properly nested" simply means
that since the <i> element is opened inside the <b> element, it must be closed inside the <b>
element.
4. XML Documents Must Have a Root Element
XML documents must contain one element that is the parent of all other elements. This element is called
the root element.
<root>
<child>
<subchild>......</subchild>
</child>
</root>
5. XML Attribute Values Must be Quoted
XML elements can have attributes in name/value pairs just like in HTML.
In XML, the attribute values must always be quoted. TREY
Mr. Husen Adem, Tutor, Ambo University || Woliso Campus, Ethiopia 11
research
XML Syntax Rules
6. Entity References
Some characters have a special meaning in XML.
If you place a character like "<" inside an XML element, it will generate an error because the parser interprets it
as the start of a new element.
< < less than
This will generate an XML error:
<message>if salary < 1000 then</message>
> > greater than
To avoid this error, replace the "<" character with an entity reference:
<message>if salary < 1000 then</message>
& & ampersand
There are 5 predefined entity references in XML:
Note: Only the characters "<" and "&" are strictly illegal in XML. ' ' Apostrophe
The greater than character is legal, but it is a good habit to replace it.
7. Comments in XML " " quotation
The syntax for writing comments in XML is similar to that of HTML. mark
<! -- This is a comment -->
Mr. Husen Adem, Tutor, Ambo University || Woliso Campus, Ethiopia TREY 12
research
XML Syntax Rules
HTML: Hello
8. White-space is preserved in XML
HTML truncates multiple white-space characters to one single white-space: Tov
With XML, the white-space in a document is not truncated. e
Mr. Husen Adem, Tutor, Ambo University || Woliso Campus, Ethiopia TREY 13
research
XML Declaration or XML Prolog
This XML declaration indicates that we're using <?xml version="1.0" encoding="UTF-8"?>
XML version 1.0, and using the UTF-8-character encoding. <document>
<heading> Hello from XML </heading>
This XML declaration, <?xml?>, uses two attributes, version and
<message> This is an XML document!
encoding, to set the version of XML and the character set we're
</message>
using. Next, we create a new XML element named <document>.
</document>
XML tags themselves always start with < and end with >. Then we
store other elements in our <document> element, or text data, as
we wish.
There are many character encodings that an XML processor can support, such as the following:
US-ASCII— U.S. ASCII ISO-10646-UCS-4— UCS
UTF-8— Compressed Unicode ISO-2022-JP— Japanese
UTF-16— Compressed UCS ISO-2022-CN— Chinese
ISO-10646-UCS-2— Unicode ISO-8859-5— ASCII and Cyrillic
Mr. Husen Adem, Tutor, Ambo University || Woliso Campus, Ethiopia TREY 14
research
Cascading style sheets (CSS)
There are two kinds of style sheets you can use with XML document:
1. Cascading Style Sheets (CSS), which you can also use with HTML documents
2. Extensible Style sheet Language style sheets (XSL), designed to be used only with XML documents.
Example 2: An XML Document Using a Style Sheet (example2.xml)
Mr. Husen Adem, Tutor, Ambo University || Woliso Campus, Ethiopia TREY 15
research
ThankYou
Husen Adem
+251925100878
[email protected]
Ambo University
TREY 16
research