Sei sulla pagina 1di 24

ANNA UNIVERSITY TIRUCHIRAPPALLI

HIERARCHICAL SCHEMA

XML FILE:

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


<catalog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="C:\xml\sche.xsd">

<book>
<bookid> 1000</bookid>
<bookname>XML &amp; Web services</bookname>
<authorname>Frankle</authorname>
<publication>O&apos;Reilly</publication>
<year>2004</year>
<price> 750</price>
<noofcopies> 100 </noofcopies>
</book>

<book>
<bookid> 1001</bookid>
<bookname>Java Programming</bookname>
<authorname>Herbert schildt</authorname>
<publication>Mc-Graw Hill</publication>
<year>2005</year>
<price> 920 </price>
<noofcopies> 90 </noofcopies>
</book>

<cd>
<cdno> 2000 </cdno>
<cdcomp> Sony </cdcomp>
<cdtype> Mini CD </cdtype>
<price> 60 </price>
<noofcopies> 75 </noofcopies>
<year>2007</year>
</cd>

<cd>
<cdno> 2001 </cdno>
<cdcomp> Moserbear </cdcomp>
<cdtype> Max CD </cdtype>
<price> 75 </price>
<noofcopies> 90 </noofcopies>
<year> 2009</year>
</cd>

</catalog>

01107903054
ANNA UNIVERSITY TIRUCHIRAPPALLI

SCHEMA FILE:

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


<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="unqualified">

<xs:element name="catalog">
<xs:complexType>
<xs:sequence>
<xs:element name="book" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="bookid">
<xs:simpleType>
<xs:restriction base="xs:int">
<xs:minExclusive value="999"> </xs:minExclusive>
<xs:maxExclusive value="10000"> </xs:maxExclusive>
</xs:restriction>
</xs:simpleType>
</xs:element>

<xs:element name="bookname">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Java Programming"/>
<xs:enumeration value="XML &amp; Web services"/>
</xs:restriction>
</xs:simpleType>
</xs:element>

<xs:element name="authorname" type="xs:string"/>


<xs:element name="publication">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Mc-Graw Hill"/>
<xs:enumeration value="O&apos;Reilly"/>
</xs:restriction>
</xs:simpleType>
</xs:element>

<xs:element name="year">
<xs:simpleType>
<xs:restriction base="xs:int">
<xs:pattern value="[0-9]{4}"/>
</xs:restriction>
</xs:simpleType>
</xs:element>

<xs:element name="price">

01107903054
ANNA UNIVERSITY TIRUCHIRAPPALLI

<xs:simpleType>
<xs:restriction base="xs:int">
<xs:minInclusive value="500"/>
<xs:maxInclusive value="1000"/>
</xs:restriction>
</xs:simpleType>
</xs:element>

<xs:element name="noofcopies">
<xs:simpleType>
<xs:restriction base="xs:byte">
<xs:enumeration value="100"/>
<xs:enumeration value="90"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>

<xs:element name="cd" maxOccurs="unbounded">


<xs:complexType>
<xs:sequence>
<xs:element name="cdno">
<xs:simpleType>
<xs:restriction base="xs:int">
<xs:minExclusive value="1999"> </xs:minExclusive>
<xs:maxExclusive value="20000"> </xs:maxExclusive>
</xs:restriction>
</xs:simpleType>
</xs:element>

<xs:element name="cdcomp">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value=" Moserbear "/>
<xs:enumeration value=" Sony "/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="cdtype">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value=" Max CD "/>
<xs:enumeration value=" Mini CD "/>
</xs:restriction>
</xs:simpleType>
</xs:element>

01107903054
ANNA UNIVERSITY TIRUCHIRAPPALLI

<xs:element name="price">
<xs:simpleType>
<xs:restriction base="xs:int">
<xs:minInclusive value="0"/>
<xs:maxInclusive value="600"/>
</xs:restriction>
</xs:simpleType>
</xs:element>

<xs:element name="noofcopies">
<xs:simpleType>
<xs:restriction base="xs:byte">
<xs:enumeration value="75"/>
<xs:enumeration value="90"/>
</xs:restriction>
</xs:simpleType>
</xs:element>

<xs:element name="year">
<xs:simpleType>
<xs:restriction base="xs:int">
<xs:pattern value="[0-9]{4}"/>
</xs:restriction>
</xs:simpleType>
</xs:element>

</xs:sequence>
</xs:complexType>
</xs:element>

</xs:sequence>
</xs:complexType>
</xs:element>

</xs:schema>

01107903054
ANNA UNIVERSITY TIRUCHIRAPPALLI

GENERIC SCHEMA

XML FILE:

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


<catalog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="C:\xml\schem.xsd">

<book material="paper" style="paperback">


<bookid> 1000</bookid>
<bookname>XML &amp; Web services</bookname>
<authorname>Frankle</authorname>
<publication>O&apos;Reilly</publication>
<year>2004</year>
<price> 750</price>
<noofcopies> 100 </noofcopies>
</book>

<book material="paper" style="paperback">


<bookid> 1001</bookid>
<bookname>Java Programming</bookname>
<authorname>Herbert schildt</authorname>
<publication>Mc-Graw Hill</publication>
<year>2005</year>
<price> 920 </price>
<noofcopies> 100 </noofcopies>
<![CDATA[Thank u for your purchase.. Visit again...]]>

</book>

<cd>
<cdno> 2000 </cdno>
<cdcomp> Sony </cdcomp>
<cdtype> Mini CD </cdtype>
<price> 60 </price>
<noofcopies> 75 </noofcopies>
<year> 2008</year>
</cd>

<cd>
<cdno> 2001 </cdno>
<cdcomp> Moserbear </cdcomp>
<cdtype> Max CD </cdtype>
<price> 75 </price>
<noofcopies> 90 </noofcopies>
<year> 2009</year>
</cd>
</catalog>

01107903054
ANNA UNIVERSITY TIRUCHIRAPPALLI

SCHEMA FILE:

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


<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="unqualified">

<xs:element name="authorname">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Frankle"/>
<xs:enumeration value="Herbert schildt"/>
</xs:restriction>
</xs:simpleType>
</xs:element>

<xs:element name="publication">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Mc-Graw Hill"/>
<xs:enumeration value="O&apos;Reilly"/>
</xs:restriction>
</xs:simpleType>
</xs:element>

<xs:simpleType name="printYear">
<xs:restriction base="xs:int">
<xs:pattern value="[0-9]{4}"/>
</xs:restriction>
</xs:simpleType>

<xs:simpleType name="priceType">
<xs:restriction base="xs:int">
<xs:minInclusive value="0"/>
<xs:maxInclusive value="1000"/>
</xs:restriction>
</xs:simpleType>

<xs:element name="noofcopies">
<xs:simpleType>
<xs:restriction base="xs:byte">
<xs:enumeration value="100"/>
<xs:enumeration value="75"/>
<xs:enumeration value="90"/>
</xs:restriction>
</xs:simpleType>
</xs:element>

<xs:element name="catalog">
<xs:complexType>
<xs:sequence>

01107903054
ANNA UNIVERSITY TIRUCHIRAPPALLI

<xs:element name="book" maxOccurs="unbounded">


<xs:complexType>
<xs:sequence>
<xs:element name="bookid">
<xs:simpleType>
<xs:restriction base="xs:int">
<xs:minExclusive value="999"> </xs:minExclusive>
<xs:maxExclusive value="10000"> </xs:maxExclusive>
</xs:restriction>
</xs:simpleType>
<xs:key name="pkkey">
<xs:selector xpath="book"/>
<xs:field xpath="bookid"/>
</xs:key>
</xs:element>

<xs:element name="bookname">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Java Programming"/>
<xs:enumeration value="XML &amp; Web services"/>
</xs:restriction>
</xs:simpleType>
</xs:element>

<xs:element ref="authorname"/>
<xs:element ref="publication"/>
<xs:element name="year" type="printYear"/>
<xs:element name="price" type="priceType"/>
<xs:element ref="noofcopies"/>
</xs:sequence>
</xs:complexType>
</xs:element>

<xs:element name="cd" maxOccurs="unbounded">


<xs:complexType>
<xs:sequence>
<xs:element name="cdno">
<xs:simpleType>
<xs:restriction base="xs:int">
<xs:minExclusive value="1999"> </xs:minExclusive>
<xs:maxExclusive value="20000"> </xs:maxExclusive>
</xs:restriction>
</xs:simpleType>
</xs:element>

<xs:element name="cdcomp">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value=" Moserbear "/>

01107903054
ANNA UNIVERSITY TIRUCHIRAPPALLI

<xs:enumeration value=" Sony "/>


</xs:restriction>
</xs:simpleType>
</xs:element>

<xs:element name="cdtype">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value=" Max CD "/>
<xs:enumeration value=" Mini CD "/>
</xs:restriction>
</xs:simpleType>
</xs:element>

<xs:element name="price" type="priceType"/>

<xs:element ref="noofcopies"/>

<xs:element name="year" type="printYear"/>

</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

01107903054
ANNA UNIVERSITY TIRUCHIRAPPALLI

DOCUMENT TYPE DEFINITION (DTD)

INTERNAL DTD -XML FILE:

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

<!DOCTYPE catalog [
<!ELEMENT catalog (book*,cd)>
<!ELEMENT book (bookid, bookname,authorname,publication, year,
comment)>

<!ELEMENT bookid (#PCDATA)>


<!ELEMENT bookname (#PCDATA)>
<!ELEMENT authorname (#PCDATA)>
<!ELEMENT publication (#PCDATA)>
<!ELEMENT year (#PCDATA)>
<!ELEMENT comment (#PCDATA)>

<!ELEMENT cd (cdno, cdcomp,cdtype,price, noofcopies)>


<!ELEMENT cdno (#PCDATA)>
<!ELEMENT cdcomp (#PCDATA)>
<!ELEMENT cdtype (#PCDATA)>
<!ELEMENT price (#PCDATA)>
<!ELEMENT noofcopies (#PCDATA)>

<!ATTLIST book
material CDATA #FIXED "paper"
style (paperback | hardcover) #IMPLIED>

<!ENTITY regCust SYSTEM "regDiscount.txt">


<!ENTITY newCust "DiscountPrice">
]>

<catalog>

<book material="paper" style="paperback">


<bookid> 1234</bookid>
<bookname>XML &amp; Web services</bookname>
<authorname>Frankle</authorname>
<publication>O&apos;Reilly</publication>
<year>2008</year>
<comment> &newCust;</comment>
</book>

<book material="paper" style="hardcover">


<bookid> 5678</bookid>
<bookname>Java Programming</bookname>
<authorname>Herbert schildt</authorname>
<publication>Mc-Graw Hill</publication>
01107903054
ANNA UNIVERSITY TIRUCHIRAPPALLI

<year>2007</year>
<comment> &regCust; </comment>
</book>

<cd>
<cdno> 2000 </cdno>
<cdcomp> Sony </cdcomp>
<cdtype> Mini CD </cdtype>
<price> 60 </price>
<noofcopies> 75 </noofcopies>
</cd>

</catalog>

OUTPUT (VIEW IN BROWSER):

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


<!DOCTYPE catalog (View Source for full doctype...)>
-<catalog>
- <book material="paper" style="paperback">
<bookid>1234</bookid>
<bookname>XML & Web services</bookname>
<authorname>Frankle</authorname>
<publication>O'Reilly</publication>
<year>2008</year>
<comment>DiscountPrice</comment>
</book>
-<book material="paper" style="hardcover">
<bookid>5678</bookid>
<bookname>Java Programming</bookname>
<authorname>Herbert schildt</authorname>
<publication>Mc-Graw Hill</publication>
<year>2007</year>
<comment>Thank you for your regular visit.. You will get 25% discount for every
purchase of book from this New Year...</comment>
</book>
- <cd>
<cdno>2000</cdno>
<cdcomp>Sony</cdcomp>
<cdtype>Mini CD</cdtype>
<price>60</price>
<noofcopies>75</noofcopies>
</cd>
</catalog>

XSLT
01107903054
ANNA UNIVERSITY TIRUCHIRAPPALLI

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

<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >

<xsl:template match="/">

<html>
<body>
<table border="2“>
<tbody>
<tr>
<th>bookid</th>
<th>bookname</th>
<th>authorname</th>
<th>publication</th>
<th>year</th>
<th>comment</th>
</tr>

<xsl:for-each select="//book">
<tr>
<td><xsl:value-of select="./bookid"></xsl:value-of></td>
<td><xsl:value-of select="./bookname"></xsl:value-of></td>
<td><xsl:value-of select="./authorname"></xsl:value-of></td>
<td><xsl:value-of select="./publication"></xsl:value-of></td>
<xsl:apply-templates select="year"/>
<td><xsl:value-of select="./comment"></xsl:value-of></td>
</tr>
</xsl:for-each>

</tbody>
</table>
</body>
</html>
</xsl:template>

<xsl:template match="year[.>2007]">
<td>
<font color="red">
<xsl:value-of select="."/>
</font>
</td>
</xsl:template>

<xsl:template match="year">
<td>
<font color="blue">

01107903054
ANNA UNIVERSITY TIRUCHIRAPPALLI

<xsl:value-of select="."/>
</font>
</td>
</xsl:template>
</xsl:stylesheet>

OUTPUT:

XSLT-INVOICE BILL PREPARATION

Orders.xml

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="invoice4.xsl"?>

01107903054
ANNA UNIVERSITY TIRUCHIRAPPALLI

<orders>
<order>
<orderno>101</orderno>
<supplyid>1</supplyid>
<orderdate>2 april 07</orderdate>
</order>
<order>
<orderno>102</orderno>
<supplyid>2</supplyid>
<orderdate>12 may 07</orderdate>
</order>
</orders>

Suppliers.xml

<?xml version="1.0"?>
<suppliers>
<supply>
<supplyid>1</supplyid>
<supplyname>Martin</supplyname>
<supplyaddress>Benz park</supplyaddress>
</supply>

<supply>
<supplyid>2</supplyid>
<supplyname>Smith</supplyname>
<supplyaddress>von Mouston</supplyaddress>
</supply>

</suppliers>

Order_details.xml

<?xml version="1.0"?>
<order_details>

<list>
<orderno>101</orderno>
<itemno>11</itemno>
<quantity>6</quantity>
</list>
<list>
<orderno>101</orderno>
<itemno>12</itemno>
<quantity>7</quantity>

</list>
<list>
<orderno>101</orderno>
<itemno>13</itemno>

01107903054
ANNA UNIVERSITY TIRUCHIRAPPALLI

<quantity>6</quantity>

</list>
<list>
<orderno>101</orderno>
<itemno>14</itemno>
<quantity>5</quantity>

</list>
<list>
<orderno>102</orderno>
<itemno>21</itemno>
<quantity>16</quantity>

</list>
<list>
<orderno>102</orderno>
<itemno>22</itemno>
<quantity>15</quantity>

</list>

</order_details>

Items.xml

<?xml version="1.0"?>
<items>
<item>
<itemno>11</itemno>
<itemname>TATA TEA</itemname>
<itemrate>65</itemrate>
</item>

<item>
<itemno>12</itemno>
<itemname>TATA HONEY</itemname>
<itemrate>35</itemrate>
</item>

<item>
<itemno>13</itemno>
<itemname>TATA SALT</itemname>
<itemrate>15</itemrate>

</item>

<item>
<itemno>14</itemno>

01107903054
ANNA UNIVERSITY TIRUCHIRAPPALLI

<itemname>TATA TYRES</itemname>
<itemrate>35</itemrate>
</item>

<item>
<itemno>21</itemno>
<itemname>WIPRO HONEY</itemname>
<itemrate>75</itemrate>
</item>

<item>
<itemno>22</itemno>
<itemname>WIPRO JAM</itemname>
<itemrate>63</itemrate>
</item>
</items>

Invoice.xsl

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


<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<head>
<title>INVOICE BILL</title>
</head>
<body>
<h1 align="center" class="style7"><strong>ABC AGENCIES</strong></h1>
<p align="center" class="style6"><strong>MOUSTON ROAD,TX-63456
</strong></p>
<table width="585" align="center">
<tr>
<td width="117"><strong>PHONE: 345678</strong></td>
<td width="36"></td>
<td width="168"><strong>MOBILE: 98765 56789</strong></td>
<td width="25"></td>
<td width="182"><strong>EMAIL:abc@gmail.com</strong></td>
<td width="29"></td>
</tr>
</table>
<p align="center" class="style6"></p>
<HR></HR>

<p align="center" class="style1 style1"><U>CASH BILL</U> </p>


<table><xsl:for-each select="//order[orderno=101]">
<xsl:variable name="no">
<xsl:value-of select="orderno"/>
</xsl:variable>
<xsl:variable name="id">

01107903054
ANNA UNIVERSITY TIRUCHIRAPPALLI

<xsl:value-of select="supplyid"/>
</xsl:variable>

<tr>
<td width="152"><span class="style2"><strong>ORDER
NO</strong>:</span><xsl:value-of select="orderno"/></td>
<td width="232"><span class="style3"><strong>ORDER
DATE</strong>:</span><xsl:value-of select="orderdate"/></td>
</tr>
<tr></tr>
<tr>
<td><span class="style4"><strong>SUPPLY ID</strong>:</span><xsl:value-
of select="supplyid"/></td>
<xsl:for-each select="document('suppliers.xml')//supply[supplyid=$id]">
<td><span class="style4"><strong>SUPPLIER NAME:</strong></span>
<xsl:value-of select="./supplyname"/></td>
<td width="277"><span class="style4"><strong>SUPPLIER
ADDRESS</strong>:</span><xsl:value-of select="./supplyaddress"/></td>
</xsl:for-each>
</tr>
</xsl:for-each>
</table>

<p></p>
<table border="2" align="center">
<tr bgcolor="#99FFFF">
<th><div align="center">ITEM NO</div></th>

<th><div align="center">ITEM NAME</div></th>


<th><div align="center">RATE</div></th>
<th><div align="center">QUANTITY</div></th>
<th><div align="center">AMOUNT</div></th>
</tr>

<xsl:for-each select="document('order_details.xml')//list[orderno=101]">
<xsl:variable name="ino">
<xsl:value-of select=".//itemno"/> </xsl:variable>
<tr><td><xsl:value-of select=".//itemno"/></td>

<xsl:for-each select="document('items.xml')//item[itemno=$ino]">

<td><xsl:value-of select="./itemname"/></td>

<xsl:variable name="ra">
<xsl:value-of select="./itemrate"/> </xsl:variable>
<td><span class="style5"><xsl:value-of

01107903054
ANNA UNIVERSITY TIRUCHIRAPPALLI

select="./itemrate"/></span></td>
<xsl:for-each select="document('order_details.xml')//list[itemno=$ino]">
<xsl:variable name="qu">
<xsl:value-of select=".//quantity"/> </xsl:variable>
<td><span class="style6"><xsl:value-of select=".//quantity"/></span></td>

<td><span class="style7">Rs. <xsl:value-of select="$ra * $qu"/></span></td>


</xsl:for-each>
</xsl:for-each>
</tr>
</xsl:for-each>
</table>
<p></p>
<p align="center"><strong>THANK YOU, VISIT AGAIN</strong></p>
<p align="center"><strong>ALL CREDIT AND DEBIT CARDS ACCEPT
</strong></p>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

OUTPUT:

01107903054
ANNA UNIVERSITY TIRUCHIRAPPALLI

SAX- STUDENT INFORMATION SYSTEM

Student.xml

01107903054
ANNA UNIVERSITY TIRUCHIRAPPALLI

<?xml version="1.0"?>
<studinfo>
<student>
<sid>101</sid>
<sname>
<first>Tommy</first>
<last>Hilbunger</last>
</sname>
<dob>
<date>24</date>
<month>April</month>
<year>1986</year>
</dob>
<sex>male</sex>
<dept>computer</dept>
<address>
<street>432 Clay</street>
<city>Houston</city>
<state>TX</state>
<zip>77004</zip>
</address>
<parent>
<father>George</father>
<mother>Mary</mother>
</parent>
<phno>9991112220</phno>
<email>tommy@gmail.com</email>
</student>

<student>
<sid>102</sid>
<sname>
<first>John</first>
<last>Martin</last>
</sname>
<dob>
<date>09</date>
<month>Sept</month>
<year>1987</year>
</dob>
<sex>male</sex>
<dept>computer</dept>
<address>
<street>15A bridge</street>
<city>London</city>
<state>TX</state>
<zip>77032</zip>
</address>
<parent>
<father>Kelvin</father>

01107903054
ANNA UNIVERSITY TIRUCHIRAPPALLI

<mother>Rose</mother>
</parent>
<phno>9767879900</phno>
<email>jmartin@gmail.com</email>
</student>

<student>
<sid>103</sid>
<sname>
<first>Gold</first>
<last>Smith</last>
</sname>
<dob>
<date>31</date>
<month>July</month>
<year>1986</year>
</dob>
<sex>male</sex>
<dept>computer</dept>
<address>
<street>38 pigeon</street>
<city>MaxStreet</city>
<state>TX</state>
<zip>77126</zip>
</address>
<parent>
<father>Ron</father>
<mother>Diane</mother>
</parent>
<phno>9635897024</phno>
<email>gsmithron@gmail.com</email>
</student>
</studinfo>

SAXDemo.java

import java.io.*;
import org.xml.sax.*;
import org.xml.sax.helpers.*;
import javax.xml.parsers.*;

public class SAXDemo extends DefaultHandler


{

public void startDocument()


{
System.out.println("****START OF THE XML FILE****");
}

public void endDocument()

01107903054
ANNA UNIVERSITY TIRUCHIRAPPALLI

{
System.out.println("****END OF THE XML FILE****");
}

public void startElement(String uri,String localName,String qName,Attributes


attributes)
{
System.out.print("<"+qName);
int n=attributes.getLength();
for(int i=0;i<n;i+=1)
{
System.out.print(" " + attributes.getQName(i) + "='" + attributes.getValue(i) + "'");
}
System.out.print(">");
}

public void characters(char[] ch,int start,int length)


{
System.out.println(new String(ch,start,length).trim());
}

public void endElement(String namespaceURI,String localName,String


qName)throws SAXException
{
System.out.print("</"+qName+">");
}

public static void main(String args[])throws Exception


{
if(args.length!=1)
{
System.err.println("Usage: java SAXDemo <xml file>");
System.exit(1);
}
SAXDemo handler=new SAXDemo();
SAXParserFactory factory=SAXParserFactory.newInstance();
SAXParser parser=factory.newSAXParser();
parser.parse(new File(args[0]),handler);
}}

OUTPUT:

E:\xml&webservices>path=c:\jdk1.5.0_01\bin

01107903054
ANNA UNIVERSITY TIRUCHIRAPPALLI

E:\xml&webservices>set classpath=%classpath%;.;

E:\xml&webservices>javac SAXDemo.java

E:\xml&webservices>java SAXDemo Student.xml

****START OF THE XML FILE****


<studinfo>
<student>

<sid>101
</sid>
<sname>
<first>Tommy
</first>
<last>Hilbunger
</last>
</sname>
<dob>
<date>24
</date>
<month>April
</month>
<year>1986
</year>
</dob>
<sex>male
</sex>
<dept>computer
</dept>
<address>
<street>432 Clay
</street>
<city>Houston
</city>
<state>TX
</state>
<zip>77004
</zip>
</address>
<parent>
<father>George
</father>
<mother>Mary
</mother>
</parent>
<phno>9991112220
</phno>
<email>tommy@gmail.com

01107903054
ANNA UNIVERSITY TIRUCHIRAPPALLI

</email>
</student>
<student>

<sid>102
</sid>
<sname>
<first>John
</first>
<last>Martin
</last>
</sname>
<dob>
<date>09
</date>
<month>Sept
</month>
<year>1987
</year>
</dob>
<sex>male
</sex>
<dept>computer
</dept>
<address>
<street>15A bridge
</street>
<city>London
</city>
<state>TX
</state>
<zip>77032
</zip>
</address>
<parent>
<father>Kelvin
</father>
<mother>Rose
</mother>
</parent>
<phno>9767879900
</phno>
<email>jmartin@gmail.com
</email>
</student>
<student>

<sid>103
</sid>
<sname>

01107903054
ANNA UNIVERSITY TIRUCHIRAPPALLI

<first>Gold
</first>
<last>Smith
</last>
</sname>
<dob>
<date>31
</date>
<month>July
</month>
<year>1986
</year>
</dob>
<sex>male
</sex>
<dept>computer
</dept>
<address>
<street>38 pigeon
</street>
<city>MaxStreet
</city>
<state>TX
</state>
<zip>77126
</zip>
</address>
<parent>
<father>Ron
</father>
<mother>Diane
</mother>
</parent>
<phno>9635897024
</phno>
<email>gsmithron@gmail.com
</email>
</student>
</studinfo>****END OF THE XML FILE****

01107903054

Potrebbero piacerti anche