You are on page 1of 17

NAME:A.Mani Kanta RollNo.

:08311A1244

//XML PROGRAM using CSS

<?xml version="1.0" encoding="ISO-8859-1"?>


<?xml-stylesheet type="text/css" href="2.css"?>
<CATALOG>
<CD>
<TITLE>Empire Burlesque</TITLE>
<ARTIST>Bob Dylan</ARTIST>
<COUNTRY>USA</COUNTRY>
<COMPANY>Columbia</COMPANY>
<PRICE>10.90</PRICE>
<YEAR>1985</YEAR>
</CD>
<CD>
<TITLE>Hide your heart</TITLE>
<ARTIST>Bonnie</ARTIST>
<COUNTRY>UK</COUNTRY>
<COMPANY>CBS Recorder</COMPANY>
<PRICE>9.90</PRICE>
<YEAR>1988</YEAR>
</CD>
<CD>
<TITLE>Greatest Hits</TITLE>
<ARTIST>Dolly Parton</ARTIST>
<COUNTRY>USA</COUNTRY>
<COMPANY>CBS Recorder</COMPANY>
<PRICE>8.90</PRICE>
<YEAR>1989</YEAR>
</CD>
</CATALOG>

//2.CSS

TITLE
{
display:Block;
color:#00000F;
font-size:20pt;
}
ARTIST
{
display:Block;
color:#0000FF;
font-size:20pt;
margin-left:10pt;
NAME:A.Mani Kanta RollNo.:08311A1244

}
COUNTRY,PRICE,YEAR,COMPANY
{
display:Block;
color:#000000;
}

OUTPUT:
NAME:A.Mani Kanta RollNo.:08311A1244

//STUDENT INFORMATION XML PROGRAM

<?xml version="1.0"?>
<student>
<new>
<name>abc</name>
<rollno>1234</rollno>
<course>IT</course>
<marks>635</marks>
</new>
<new>
<name>xyz</name>
<rollno>1235</rollno>
<course>CSE</course>
<marks>625</marks>
</new>
<new>
<name>pqr</name>
<rollno>1236</rollno>
<course>ECE</course>
<marks>630</marks>
</new>
</student>

OUTPUT:
NAME:A.Mani Kanta RollNo.:08311A1244
NAME:A.Mani Kanta RollNo.:08311A1244

//XML PROGRAM

//Internal DTD

<?xml version="1.0"?>
<!DOCTYPE student [
<!ELEMENT student (name,rollno,course,marks)>
<!ELEMENT name (#PCDATA)>
<!ELEMENT rollno (#PCDATA)>
<!ELEMENT course (#PCDATA)>
<!ELEMENT marks (#PCDATA)>
]>
<student>
<name>abc</name>
<rollno>1234</rollno>
<course>IT</course>
<marks>635</marks>
</student>

OUPUT:
NAME:A.Mani Kanta RollNo.:08311A1244

//External DTD

//student.dtd

<?xml version="1.0" encoding="UTF-8"?>


<!ELEMENT student (name,rollno,course,marks)>
<!ELEMENT name (#PCDATA)>
<!ELEMENT rollno (#PCDATA)>
<!ELEMENT course (#PCDATA)>
<!ELEMENT marks (#PCDATA)>

//student.xml

<?xml version="1.0"?>
<!DOCTYPE student SYSTEM "student.dtd">
<student>
<name>abc</name>
<rollno>1234</rollno>
<course>IT</course>
<marks>635</marks>
</student>

OUTPUT:
NAME:A.Mani Kanta RollNo.:08311A1244
NAME:A.Mani Kanta RollNo.:08311A1244

//XML SCHEMA PROGRAM

//2.xsd

<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="STUDENT">
<xs:complexType>
<xs:sequence>
<xs:element name="ROLLNUMBER" type="xs:integer"/>
<xs:element name="NAME" type="xs:string"/>
<xs:element name="MARKS" type="xs:integer"/>
<xs:element name="RESULT" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

//student.xml

<?xml version="1.0"?>
<STUDENT>
<ROLLNUMBER>1234</ROLLNUMBER>
<NAME>abc</NAME>
<MARKS>635</MARKS>
<RESULT>yes</RESULT>
</STUDENT>

OUTPUT:
NAME:A.Mani Kanta RollNo.:08311A1244
NAME:A.Mani Kanta RollNo.:08311A1244

//XLST table format XML PROGRAM

//employee.xslt

<?xml version='1.0'?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Employee</title>
</head>
<body>
<table border="1" bgcolor="pink">
<thead>
<tr>
<th>ID</th>
<th>Empname</th>
<th>Designation</th>
<th>Dept</th>
</tr>
</thead>
<xsl:for-each select="sports/game">
<tr>
<td><xsl:value-of select="@id"/></td>
<td><xsl:value-of select="name"/></td>
<td><xsl:value-of select="designation"/></td>
<td><xsl:value-of select="dept"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

//employee.xml

<?xml version="1.0"?>
<sports>
<game id="9544">
<name>sssss</name>
<designation>Asst prof</designation>
NAME:A.Mani Kanta RollNo.:08311A1244

<dept>IT</dept>
</game>
</sports>

OUTPUT:
NAME:A.Mani Kanta RollNo.:08311A1244

//XML PROGRAM using XSLT internal DTD

//studentintDTD.xml

<?xml version="1.0"?>
<!DOCTYPE student [
<!ELEMENT student (name,rollno,course,marks)>
<!ELEMENT name (#PCDATA)>
<!ELEMENT rollno (#PCDATA)>
<!ELEMENT course (#PCDATA)>
<!ELEMENT marks (#PCDATA)>
]>
<student>
<name>abc</name>
<rollno>1234</rollno>
<course>IT</course>
<marks>635</marks>
</student>

//studentxslt.xsl

<?xml version='1.0'?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Employee</title>
</head>
<body>
<xsl:for-each select="student">
<xsl:value-of select="name"/>
<xsl:value-of select="rollno"/>
<xsl:value-of select="course"/>
<xsl:value-of select="marks"/>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

OUTPUT:
NAME:A.Mani Kanta RollNo.:08311A1244

//student.dtd

<?xml version="1.0" encoding="UTF-8"?>


<!ELEMENT student (name,rollno,course,marks)>
<!ELEMENT name (#PCDATA)>
<!ELEMENT rollno (#PCDATA)>
<!ELEMENT course (#PCDATA)>
<!ELEMENT marks (#PCDATA)>
NAME:A.Mani Kanta RollNo.:08311A1244

//studentextDTD.xml

<?xml version="1.0"?>
<!DOCTYPE student SYSTEM "student.dtd">
<student>
<name>abc</name>
<rollno>1234</rollno>
<course>IT</course>
<marks>635</marks>
</student>

//studentxslt.xsl

<?xml version='1.0'?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Employee</title>
</head>
<body>
<xsl:for-each select="student">
<xsl:value-of select="name"/>
<xsl:value-of select="rollno"/>
<xsl:value-of select="course"/>
<xsl:value-of select="marks"/>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

OUTPUT:
NAME:A.Mani Kanta RollNo.:08311A1244
NAME:A.Mani Kanta RollNo.:08311A1244

//JAVA BEANS

//color.java

import java.awt.*;
import java.awt.event.*;
public class Colors extends Canvas
{
private Color color;
private boolean rectangular;
public Colors()
{
addMouseListener(new MouseAdapter()
{
public void mousePressed(MouseEvent me)
{
change();
}
});
rectangular=false;
setSize(200, 100);
change();
}

public boolean getRectangular()


{
return rectangular;
}

public void setRectangular(boolean flag)


{
this. rectangular = flag;
repaint();
}

public void change()


{
color = randomColor();
repaint();
}
NAME:A.Mani Kanta RollNo.:08311A1244

private Color randomColor()


{
int r = (int)(255*Math.random());
int g = (int)(255*Math.random());
int b = (int)(255*Math.random());
return new Color(r,g,b);
}
public void paint (Graphics g)
{
Dimension d = getSize();
int h = d.height;
int w = d.width;
g.setColor(color);
if(rectangular)
{
g.fillRect(0, 0, w-1, h-1);
}
else
{
g.fillOval(0, 0, w-1, h-1);
}
}
}

//manifest.mft

Name: Colors.class
Java-Bean: True