Sunteți pe pagina 1din 8

ASSIGN 1

Introduction to XML
Assume that data for a book catalogue is available. An XML document for the
book catalogue with the following elements: name, author, pages, price and table
of contents are to be created. The price element should also specify whether the
book is accompanied with a CD or DVD or both.

Create an XML document for the above mentioned catalogue displaying data for
about 10 books.

ASSIGN 2
Namespaces
Global Express is USA’s leading integrated air express carrier and premium
logisticsservices provider. They have the most extensive domestic network
covering over 20 locations.

Every office of theirs has to maintain a record of the letters despatched on a day-
today basis. These records are stored in hard copies which make them prone to
damage or loss of data. To overcome this possibility, the company has decided to
store the information in computers and the data is to be transferred using XML.

Create an XML file called “Order.xml” using the following element names. Follow
the specifications provided in the data given below.

· Invoice

· Order: (Should have an order number attribute)


· Customer Name
· Address
· Order id
· Total Price

· Cod:
· Shipping Address
· Shipping method (air or ground)
· Shipping total
· Account: (State if the account is active or not. The default should be active.)
· Customer ID
· Invoice period

· Shipping info:
· Ship date
· Billing Address (This element should be optional)

· Description
· Description should be one of the product

Keeping into considerations that there are five regional offices and five different
set of data is to be merged at the Head office, duplication of data is a huge
possibility.

For example, Customer Name in New York can match a customer name in a
Chicago.
To differentiate the data when it is merged, use namespaces to declare elements.
Use entity declarations wherever necessary in the XML document.

ASSIGN 3
Document Type Definitions

Local Courier Service Simulation


The local courier service XYZ has branches all over the country. Every region
has one regional office that coordinates with the branches in that region. Couriers
from the branches are collected and sent to the regional office for sorting and
despatch. Similarly, incoming couriers are sorted at the regional office and sent to
the branches.

Every regional office has to maintain a record of the couriers it receives from the
branches and of couriers it sends to the branches. Similarly, it needs to maintain
records of couriers it sends to other regional offices and receives from other
regional offices.

The officials no longer wish to transfer these records as hard copy, which makes
it prone to so many possibilities of being damaged or corrupted. They have
decided to employ data operators who will feed the information into computers
and transfer the data using XML.

Now, the foreseen problem is multiple data operators entering similar data using
XML. To resolve the inconsistency that could occur due to operators developing
their own tags officials have requested for standardization of the tags to be used.

Based on these existing conditions, write a DTD for the above problem. Once the
DTD is finalized, test the DTD with fake data. Test both internal and external
DOCTYPE declarations.

Make sure tags for addresses are adequate and capable enough to hold any
form of address data (Hint: Some addresses have villas while some buildings
and apartment number. Look for all possible kinds of addresses and then create
the element). The format for how the data will be structured too is open-ended
but should be optimal for the above purpose.

(Hint: Make use of the different element declarations. The DTD should take care
of information such as branch/regional details, courier details (from and to
details), date of receipt of couriers or despatch of couriers,
transportation/shipping details, etc)

ASSIGN 4

XML Schema
An XML file will be used to represent data collected from an online sales web
site. This site sells different kinds of office supplies. Create an XML file that
captures the following information:

· Item Name - examples include "paper", "clips", "rubber bands", "pens", etc.

· Item Inventory ID - examples include "F12333", "Z55553", etc - restrictions are


that the Inventory ID must begin with a letter followed by 5 digits.

· Item Unit Price - examples include 4.553, 22.33, etc - must be a double and no
less than 1.00

· Count in Stock - whole number no less than 0


· Stock Bin - this is where the item is located in the stock room - examples
include "B786", "B345", etc. - restrictions are that this must be the letter B
followed by three digits

1. Create a Schema file that clearly defines the tags, their elements, data types
and implements the restrictions indicated.

2. Create an XML file that represents this data. Use some sample data. Make
sure the XML file is well formed.

3. Make sure the Schema file works with the XML file.

ASSIGN 5
Style Sheets

University Result Simulation


A university desires to display the exam results of its students for all semesters
using XML and CSS. The results should be displayed as follows:
Figure 1: Output Result At the top of the screen, the name of the university should be
displayed in white on black background with a border. Then on the next line(s) the
address of the university should be displayed in the same manner except that the border
need not be so prominent.

The results should be displayed in the following manner. First the Semester
number should be displayed in white over a black background. Next, a student’s
name should follow in white over grey background. The students name should
follow by a block of subject names and the student’s grades in those subjects. All
the students, for the respective semester, should be represented in the following
manner. The next semester’s details should follow the first one and so on.

Create the XML and CSS document for the same. Simulate data for about fifteen
students (three semesters – five students each).

ASSIGN 6
XSL and XSLT

Real estate scenario

A local software company Navigator Ltd. deals with the maintenance of data about locations

and finance of different showrooms. The company collects the information about the various

branches of big showrooms and stores it in its database.

The information includes the number of branches, the amount the branch has to pay as rent,

the amount of money that the branch has taken as a loan, the number of people working in

that branch and so on.

Every showroom has to register these details in a database. Since it is highly impossible to

maintain a record of each and every branch in a country, the IT hub of the showroom decide

to outsource it to this software company.


There is a sudden audit in the showroom and the data abstractors of the software company

were made to give the following details on an urgent basis:

· Divide the number of people according to the batches that have joined.

· The rent that each individual branch pays to their respective landlord.

· The daily allowance given to the people in all the branches according to the seniority.

Now, prepare a report and display the output in XML using XSL as the style sheet. After the

transformation is done, display the records of each section separately. As these results are to

be shown to the auditors directly, ensure that proper and clear formatting is done.

Ensure that the data is displayed in a complete formal manner.

(Hint: Make use of < xsl:template >, < xsl:select >, < xsl:value-of >, < xsl:for-each >, <

xsl:sort >).

ASSIGN 7
More on XSLT
Alveira Technologies, a business process outsourcing firm based in San Jose,
was storing details of its employees in XML format. Suddenly the management
decided to migrate all its data to HTML format. An application needs to be
created that will design and implement an XSLT stylesheet to transform the XML
content to HTML format. Make use of Xpath and XSLT to achieve the same.

ASSIGN 8
DOM

Bank Account Simulation


Create an XML document containing data about 10 bank customers. Each customers name,

account number, account type, and balance should be displayed in the XML file. Provide a DTD

for the XML document and validate the XML document.

Using JavaScript language, create an HTML file that displays all the customer data from the

above XML file. The data should be presented in a table with row headers as Customer Name,

Account Number, Account Type and Balance and respective data in the column below.

The output would look something like this:

Hint: Use DOM

ASSIGN 9
XML DOM and Sax Objects

Create an HTML file that will generate a document object model of an XML file named

movie.xml and traverse it.


Write a Java program that will count the instances of 'movie' elements in the XML file

movie.xml.

Hint: Use the SAX Parser.

S-ar putea să vă placă și