JAGANS COLLEGE OF ENGINEERING & TECHNOLOGY,
NELLORE
EXP. NAME:DISPLAY BOOK INFORMATION USING XML
Aim:-Write an XML program to display book information using DOCUMENT TYPE
DEFINITION
Catalogdemo.xml
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet
type="text/css" href="library.css"?>
<catalog
xmlns:xsi="http://www.w3.org/2001/xmlschemainstance"
xsi:noNamespaceSchemaLocation="catalog.xsd">
<Book>
<Title>xmlbible</Title>
<Author>winston</Author>
<Edition>6th</Edition>
<Publication>wiely</Publication>
<isbn>0-7659-4652-7</isbn>
<Price>$40.5</Price>
</Book>
<Book>
<Title>artificialintelegence</Title>
<Author>s.ruseel</Author>
<Edition>6th</Edition>
<Publication>princeston</Publication>
<isbn>0-7659-4652-7</isbn>
<Price>$45.5</Price>
30
JAGANS COLLEGE OF ENGINEERING & TECHNOLOGY,
NELLORE
EXP. NAME:DISPLAY BOOK INFORMATION USING XML
</Book>
<Book>
<Title>html</Title>
<Author>sampoter</Author>
<Edition>6th</Edition>
<Publication>sampublication</Publication>
<isbn>0-7659-4652-7</isbn>
<Price>$60.5</Price>
</Book>
<Book>
<Title>java2</Title>
<Author>watson</Author>
<Edition>6th</Edition>
<Publication>wiston</Publication>
<isbn>0-7659-4652-7</isbn>
<Price>$65.5</Price>
</Book>
</catalog>
31
JAGANS COLLEGE OF ENGINEERING & TECHNOLOGY,
NELLORE
EXP. NAME:DISPLAY BOOK INFORMATION USING XML
Catalog.xsd
<? xml version=1.0encoding =UTF_8?>
<XS:schema
Xmlns:XS=http://www.w3.org/2001/xmlnssvhema
>
<XS:elementname=catalog>
<XS:complextype>
<XS:sequence>
<XS:element
Ref=Bookminoccurs=1maxoccurs=unbounded
/>
</XS:sequence>
</XS:complextype>
<XS:elementname=Book>
<XS:complextype>
<XS:sequence>
<XS:element>
ref=Titleminoccurs=1maxoccurs=1/>
<XS:element
ref=Authorminoccurs=1maxoccurs=1/>
<XS:element
ref=Publicationsminoccurs=1maxoccurs=1/>
<XS:element
ref=Editionminoccurs=1maxoccurs=1/>
32
JAGANS COLLEGE OF ENGINEERING & TECHNOLOGY,
NELLORE
EXP. NAME:DISPLAY BOOK INFORMATION USING XML
<XS:element
ref=ISBNminoccurs=1maxoccurs=1/>
<XS:element
ref=Priceminoccurs=1maxoccurs=1/>
</XS:sequence>
</XS:complextype>
<XS:element name=Title type=XS:string/>
<XS:element name=Authour type=XS:string/>
<XS:element
name=Publications type=XS:string/>
<XS:element name=Edition type=XS:string/>
<XS:element name=ISBN type=XS:string/>
<XS:element name=Price type=XS:string/>
</XS:schema>
33
JAGANS COLLEGE OF ENGINEERING & TECHNOLOGY,
NELLORE
EXP. NAME:DISPLAY BOOK INFORMATION USING XML
library.css
catalog
{
font_family:arial;
color:red;
font-size:16pt
}
book
{
display:block;
font-family:time new roman;
color:blue;
table-layout:auto;
font-size:14pt
}
title
{
font-family:arial;
color:green;
font-size:12pt
}
author
{
34
JAGANS COLLEGE OF ENGINEERING & TECHNOLOGY,
NELLORE
EXP. NAME:DISPLAY BOOK INFORMATION USING XML
font-family:arial;
color:magenta;
}
edition,ISBN,publication,price
{
display:block;
font-family:arial;
color:green;
margin-left:20pt
font-size:10pt
}
{
font-family:arial;
color:green;
font-size:12pt
}
autor
{
font-family:arial;
color:magenta;}
publication,edition,ISBN,price
{
disply:block;
35
JAGANS COLLEGE OF ENGINEERING & TECHNOLOGY,
NELLORE
EXP. NAME:DISPLAY BOOK INFORMATION USING XML
font-family=arial;
color:black;
font-size:10pt;
margin-left:20pt
}
36
JAGANS COLLEGE OF ENGINEERING & TECHNOLOGY,
NELLORE
EXP. NAME:DISPLAY BOOK INFORMATION USING XML
37