Assign XML
Assign XML
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
· 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
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 Unit Price - examples include 4.553, 22.33, etc - must be a double and no
less than 1.00
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
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
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
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
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
· 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.
(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
account number, account type, and balance should be displayed in the XML file. Provide a DTD
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.
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.