XML Lab Manual
XML Lab Manual
LAB
MANUAL
PCA15501 – XML & WEB SERVICES
For
P.G. Degree Programme
Batch (2016– 2018)
MCA (5th Semester)
Prepared By Approved By
1
` SRM UNIVERSITY
Ramapuram Campus, Chennai-600089.
Department Of Computer Applications
INDEX
5. XML SCHEMA 15
9 XPATH IMPLEMENTATION 42
13 WEB SERVICES 55
2
` SRM UNIVERSITY
Ramapuram Campus, Chennai-600089.
Department Of Computer Applications
EX.NO.: 01
3
` SRM UNIVERSITY
Ramapuram Campus, Chennai-600089.
Department Of Computer Applications
**XML file
<?xml version="1.0"?>
<addbook>
<details>
<name>John Smith</name>
<DOB>2-january-1978</DOB>
<city>Chennai</city>
<state>Tamilnadu</state>
<pincode>600089</pincode>
<work title="Project Manager" company="TCS" city="Chennai"></work>
<phoneno>984002561</phoneno>
<email>john@yahoo.in</email>
</details>
<details>
<name>Annie</name>
<DOB>30-March-1982</DOB>
<city>Ville Parle</city>
<state>Mumbai</state>
<pincode>876001</pincode>
<work title="HR" company="Wipro" city="Mumbai"></work>
<phoneno>9600560190</phoneno>
<email>annie@gmail.com</email>
</details>
</addbook>
4
` SRM UNIVERSITY
Ramapuram Campus, Chennai-600089.
Department Of Computer Applications
OUTPUT
Result:
The XML Document executed successfully.
5
` SRM UNIVERSITY
Ramapuram Campus, Chennai-600089.
Department Of Computer Applications
EX.NO.: 02
6
` SRM UNIVERSITY
Ramapuram Campus, Chennai-600089.
Department Of Computer Applications
SIMPLE XML DOCUMENT-ATTRIBUTES
<ADDRESSBOOK>
<PERSON1
Name="N Krishnamoorthy"
Age="45"
Dob="06-02-1976"
Mobile="944339443"
Mail="krishnamoorthy@yahoo.com"
Streetname="Thiruneermalai Road"
Houseno="303"
Area="Thirumudivakkam"
Pincode="600044"
City="Chennai"
State="Tamilnadu"
/>
<PERSON2
Name="Balavinayagam"
Age="27"
Dob="09-06-1990"
Mobile="9600365435"
Mail="balavinayak@yahoo.com"
Streetname="North Car Street"
Houseno="77/99a"
Area="Rockfort"
Pincode="600002"
City="tiruchirappalli"
State="Tamilnadu"
/>
<PERSON3
Name="Sushmitha"
Age="47"
Dob="09-02-1970"
Mobile="9789548789"
Mail="Sushmi_67@gmail.com"
Streetname="Haneefa Colony"
Houseno="548"
Area="Vaniyambadi"
Pincode="625689"
City="Vaniyambadi"
State="Tamilnadu"
/>
</ADDRESSBOOK>
7
` SRM UNIVERSITY
Ramapuram Campus, Chennai-600089.
Department Of Computer Applications
Output:
Result:
The simple XML document for generating address book is done with the attributes.
8
` SRM UNIVERSITY
Ramapuram Campus, Chennai-600089.
Department Of Computer Applications
Ex.No:.3
Algorithm:
Step 5: Root element consist of Mike’s store as name value, topic consist of
xml as name value, ISBN is 120-90-100 attribute of book, title include
some contents, Mike Jervis as author value
9
` SRM UNIVERSITY
Ramapuram Campus, Chennai-600089.
Department Of Computer Applications
INTERNAL DTD
<?xml version="1.0"?>
<!DOCTYPE bookstore [
<!ELEMENT bookstore (name,topic+)>
<!ELEMENT topic (name,book*)>
<!ELEMENT name (#PCDATA)>
<!ELEMENT book (title,author)>
<!ELEMENT title (#PCDATA)>
<!ELEMENT author (#PCDATA)>
<!ATTLIST book ISBN CDATA "0">
]>
<bookstore>
<name>Mike's Store</name>
<topic>
<name>XML</name>
<book ISBN="120-90-100">
<title>Mike's Guide To DTD's and XML Schemas</title>
<author>Mike Jervis</author>
</book>
</topic>
</bookstore>
10
` SRM UNIVERSITY
Ramapuram Campus, Chennai-600089.
Department Of Computer Applications
OUTPUT
Result:
XML file executed successfully.
11
` SRM UNIVERSITY
Ramapuram Campus, Chennai-600089.
Department Of Computer Applications
Ex.No:.4
Algorithm:
Step 1: Open Notepad.
Step 2: Create a DTD file for element and sub elements.
Step 3: Save the file as. DTD extension.
Step 4: Create a new XML file
Step 5: Implement the DTD file with syntax
[!DOCTYPE SYSTEM “filename”]
Step 6: save the file with .xml extension.
Step 7: Run the XML file in Browser.
12
` SRM UNIVERSITY
Ramapuram Campus, Chennai-600089.
Department Of Computer Applications
External DTD
<?xml version="1.0"?>
<!ELEMENT Combomeal (burger,fries,drink)>
<!ENTITY COLA "Pepsi" >
<!ELEMENT burger(name,bun)>
<!ELEMENT name (#PCDATA)>
<!ELEMENT bun (meat,cheese,chick)>
<!ATTLIST bun bread (white|wheat) #REQUIRED>
<!ELEMENT meat EMPTY>
<!ELEMENT cheese EMPTY>
<!ELEMENT chick EMPTY>
<!ELEMENT fries EMPTY>
<!ATTLIST fries size (small|medium|large) #REQUIRED>
<!ELEMENT drink (#PCDATA)>
<!ATTLIST drink size (small|medium|large) #REQUIRED>
13
` SRM UNIVERSITY
Ramapuram Campus, Chennai-600089.
Department Of Computer Applications
Output:
Result:
XML file executed successfully.
14
` SRM UNIVERSITY
Ramapuram Campus, Chennai-600089.
Department Of Computer Applications
Ex.No:.5
XML SCHEMA
Algorithm :
Step 1:open notepad for creating .dtd file for xml schema definition .
Step 2: define the data types of elements which is to be defined in xml file.
Step 3: close the root element of .dtd file and save it.
Step 4: Open another notepad for xml file
Step 5: define respected element as defined in the .dtd file and define the value.
Step6. close all the subsequent elements tag.
Step 7: save the file with .xml extension
Step 8: Open Browser and open the XML file.
15
` SRM UNIVERSITY
Ramapuram Campus, Chennai-600089.
Department Of Computer Applications
XML SCHEMA
<?xml version="1.0"?>
<xs:schema>
<xmlns:xs="http://www.w3.org/2001/XMLNS schema"
target namespace="http://www.w3schools.com
element form default="qualified">
<xs:element name="to"type="xs:string"/>
<xs:element name="heading"type=xs:string"/>
<xs:element name="body"type="xs:string"/>
</xs:sequence>
</xs:complex type>
</xs:element>
</xs:schema>
XML file
<?xml version="1.0"?>
<note xmlns="http://www.w3cschools.com"
xmlns:xsi="http://www.w3.org/2001/XMLNS schema_instance"
xsi:xmlSchemaLocation="http:/w3cschoools.com note.xsd">
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>don't forgot me</body>
</note>
16
` SRM UNIVERSITY
Ramapuram Campus, Chennai-600089.
Department Of Computer Applications
Output:
Result:
XML file executed successfully.
17
` SRM UNIVERSITY
Ramapuram Campus, Chennai-600089.
Department Of Computer Applications
Ex.No :.6
Algorithm :
Step 1:open notepad.
Step 2:write css code for the elements and sub elements and save it with .css
extension.
Step 3: Create a new XML file and implement the css file in XML file. Save it
with .css extension.
Step 4: Open Browser and open the XML file.
18
` SRM UNIVERSITY
Ramapuram Campus, Chennai-600089.
Department Of Computer Applications
19
` SRM UNIVERSITY
Ramapuram Campus, Chennai-600089.
Department Of Computer Applications
<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="bookes.css"?>
<bookstore>
<book> Book Detail </book>
<title> Title: ANSI C </title>
<author> Author : Balagurusamy </author>
<rs> Price : 250 </rs>
</bookstore>
Output:
Result:
XML file executed successfully.
20
` SRM UNIVERSITY
Ramapuram Campus, Chennai-600089.
Department Of Computer Applications
Ex.No:.7
XSL TRANSFORMATION
Aim:
To create a simple XSLT transformation from XSL to XML.
Algorithm:
Step-2: Using XSLT document, we can create a style sheet like Font Style, Font Size,
Step-5: Create a Link with the XSLT document using href tag=”Filename.xsl” and write
Step-7: Then execute the xml file and view the output:
21
` SRM UNIVERSITY
Ramapuram Campus, Chennai-600089.
Department Of Computer Applications
XSL TRANSFORMATION
Source Code:
Filename:“cdcatalog.xsl”
22
` SRM UNIVERSITY
Ramapuram Campus, Chennai-600089.
Department Of Computer Applications
Source Code:
Filename: “Simpxsl.xml”
<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="cdcatalog.xsl"?>
<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 Tyler</artist>
<country>UK</country>
<company>CBS Records</company>
<price>9.90</price>
<year>1988</year>
</cd>
<cd>
<title>Greatest Hits</title>
<artist>Dolly Parton</artist>
<country>USA</country>
<company>RCA</company>
<price>9.90</price>
<year>1982</year>
</cd>
<cd>
<title>Still got the blues</title>
23
` SRM UNIVERSITY
Ramapuram Campus, Chennai-600089.
Department Of Computer Applications
<artist>Gary Moore</artist>
<country>UK</country>
<company>Virgin records</company>
<price>10.20</price>
<year>1990</year>
</cd>
<cd>
<title>Eros</title>
<artist>Eros Ramazzotti</artist>
<country>EU</country>
<company>BMG</company>
<price>9.90</price>
<year>1997</year>
</cd>
<cd>
<title>One night only</title>
<artist>Bee Gees</artist>
<country>UK</country>
<company>Polydor</company>
<price>10.90</price>
<year>1998</year>
</cd>
<cd>
<title>Sylvias Mother</title>
<artist>Dr.Hook</artist>
<country>UK</country>
<company>CBS</company>
<price>8.10</price>
<year>1973</year>
</cd>
<cd>
<title>Maggie May</title>
<artist>Rod Stewart</artist>
<country>UK</country>
<company>Pickwick</company>
<price>8.50</price>
<year>1990</year>
24
` SRM UNIVERSITY
Ramapuram Campus, Chennai-600089.
Department Of Computer Applications
</cd>
<cd>
<title>Romanza</title>
<artist>Andrea Bocelli</artist>
<country>EU</country>
<company>Polydor</company>
<price>10.80</price>
<year>1996</year>
</cd>
<cd>
<title>When a man loves a woman</title>
<artist>Percy Sledge</artist>
<country>USA</country>
<company>Atlantic</company>
<price>8.70</price>
<year>1987</year>
</cd>
<cd>
<title>Black angel</title>
<artist>Savage Rose</artist>
<country>EU</country>
<company>Mega</company>
<price>10.90</price>
<year>1995</year>
</cd>
<cd>
<title>1999 Grammy Nominees</title>
<artist>Many</artist>
<country>USA</country>
<company>Grammy</company>
<price>10.20</price>
<year>1999</year>
</cd>
<cd>
<title>For the good times</title>
<artist>Kenny Rogers</artist>
<country>UK</country>
25
` SRM UNIVERSITY
Ramapuram Campus, Chennai-600089.
Department Of Computer Applications
<company>Mucik Master</company>
<price>8.70</price>
<year>1995</year>
</cd>
<cd>
<title>Big Willie style</title>
<artist>Will Smith</artist>
<country>USA</country>
<company>Columbia</company>
<price>9.90</price>
<year>1997</year>
</cd>
<cd>
<title>Tupelo Honey</title>
<artist>Van Morrison</artist>
<country>UK</country>
<company>Polydor</company>
<price>8.20</price>
<year>1971</year>
</cd>
<cd>
<title>Soulsville</title>
<artist>JornHoel</artist>
<country>Norway</country>
<company>WEA</company>
<price>7.90</price>
<year>1996</year>
</cd>
<cd>
<title>The very best of</title>
<artist>Cat Stevens</artist>
<country>UK</country>
<company>Island</company>
<price>8.90</price>
<year>1990</year>
</cd>
<cd>
26
` SRM UNIVERSITY
Ramapuram Campus, Chennai-600089.
Department Of Computer Applications
<title>Stop</title>
<artist>Sam Brown</artist>
<country>UK</country>
<company>A and M</company>
<price>8.90</price>
<year>1988</year>
</cd>
<cd>
<title>Bridge of Spies</title>
<artist>T`Pau</artist>
<country>UK</country>
<company>Siren</company>
<price>7.90</price>
<year>1987</year>
</cd>
<cd>
<title>Private Dancer</title>
<artist>Tina Turner</artist>
<country>UK</country>
<company>Capitol</company>
<price>8.90</price>
<year>1983</year>
</cd>
<cd>
<title>Midtomnatten</title>
<artist>Kim Larsen</artist>
<country>EU</country>
<company>Medley</company>
<price>7.80</price>
<year>1983</year>
</cd>
<cd>
<title>Pavarotti Gala Concert</title>
<artist>Luciano Pavarotti</artist>
<country>UK</country>
<company>DECCA</company>
<price>9.90</price>
27
` SRM UNIVERSITY
Ramapuram Campus, Chennai-600089.
Department Of Computer Applications
<year>1991</year>
</cd>
<cd>
<title>The dock of the bay</title>
<artist>Otis Redding</artist>
<country>USA</country>
<company>Atlantic</company>
<price>7.90</price>
<year>1987</year>
</cd>
<cd>
<title>Picture book</title>
<artist>Simply Red</artist>
<country>EU</country>
<company>Elektra</company>
<price>7.20</price>
<year>1985</year>
</cd>
<cd>
<title>Red</title>
<artist>The Communards</artist>
<country>UK</country>
<company>London</company>
<price>7.80</price>
<year>1987</year>
</cd>
<cd>
<title>Unchain my heart</title>
<artist>Joe Cocker</artist>
<country>USA</country>
<company>EMI</company>
<price>8.20</price>
<year>1987</year>
</cd>
</catalog>
28
` SRM UNIVERSITY
Ramapuram Campus, Chennai-600089.
Department Of Computer Applications
OUTPUT
Result:
Thus the program to convert the simple XSLT transformation from XSL to XML
has been executed successfully.
29
` SRM UNIVERSITY
Ramapuram Campus, Chennai-600089.
Department Of Computer Applications
Ex.No:7
XSL TRANSFORMATION-BOOK SHOP
Aim:
To create a simple XSLT transformation from XSL to XML.
Algorithm:
Step-2: Using XSLT document, we can create a style sheet like Font Style, Font Size,
Step-5: Create a Link with the XSLT document using href tag=”style.xsl” and write the
following code:
Step-7: Then execute the xml file and view the output:
30
` SRM UNIVERSITY
Ramapuram Campus, Chennai-600089.
Department Of Computer Applications
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="style.xsl"?>
<BooksforYou>
<Book BookID = "1000">
<Title>If Tomorrow Comes</Title>
<Rate>275</Rate>
<Author>Krishna Kumar</Author>
<Publication>Pearson</Publication>
<ISBN>111-222-333</ISBN>
</Book>
<Book BookID ="1001">
<Title>.NET Expert Guide</Title>
<Rate>475</Rate>
<Author>James</Author>
<Publication>Microsoft Press</Publication>
<ISBN>121-222-333</ISBN>
</Book>
<Book BookID ="1002">
<Title>C Projects</Title>
<Rate>275</Rate>
<Author>YashwantP.Kanetkar</Author>
<Publication>BPB Publications</Publication>
<ISBN>111-232-333</ISBN>
</Book>
<Book BookID ="1003">
<Title>Let us C</Title>
<Rate>225</Rate>
<Author>YashwantP.Kanetkar</Author>
<Publication>BPB Publications</Publication>
<ISBN>111-222-353</ISBN>
</Book>
31
` SRM UNIVERSITY
Ramapuram Campus, Chennai-600089.
Department Of Computer Applications
//XSLT DOCUMENT
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheetxmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0" >
<xsl:template match="/">
<html>
<body background="tech.gif">
<h1 align="center">
<font color="blue">Books at your own Cyber Shoppe</font>
</h1>
<tbody>
<tr>
<th>Book ID</th>
<th>Title</th>
<th>Rate</th>
<th>Author</th>
<th>Publication</th>
32
` SRM UNIVERSITY
Ramapuram Campus, Chennai-600089.
Department Of Computer Applications
<th>ISBN</th>
</tr>
<xsl:for-each select="BooksforYou/Book">
<tr>
<td><xsl:value-of select="@BookID"/></td>
<td><xsl:value-of select="Title"/></td>
<td><xsl:value-of select="Rate"/></td>
<td><xsl:value-of select="Author"/></td>
<td><xsl:value-of select="Publication"/></td>
<td><xsl:value-of select="ISBN"/></td>
</tr>
</xsl:for-each>
</tbody>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
33
` SRM UNIVERSITY
Ramapuram Campus, Chennai-600089.
Department Of Computer Applications
OUTPUT
If Tomorrow 111-
1000 275 Krishna Kumar Pearson
Comes 222-333
BPB 111-
1002 C Projects 275 YashwantP.Kanetkar
Publications 232-333
BPB 111-
1003 Let us C 225 YashwantP.Kanetkar
Publications 222-353
Com and
BPB 111-
1004 Beyond in 375 YashvantP.Kanetkar
Publications 555-333
VC++
Result:
Thus the program to convert the simple XSLT transformation from XSL to
XML has been executed successfully.
34
` SRM UNIVERSITY
Ramapuram Campus, Chennai-600089.
Department Of Computer Applications
Ex.No: 8
XSL FORMATTING
Aim:
Algorithm:
Step-2: In the XML Document specify the .xsl file name in href.
Step-5: Create a Link with the XSLT document using href tag write the code:
Step-7: Then execute the xml file and view the output:
35
` SRM UNIVERSITY
Ramapuram Campus, Chennai-600089.
Department Of Computer Applications
XSL FORMATTING
<?xml version="1.0"?>
<root/>
XSL Document
//decimalformat.xsl
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="decimalformat.xsl"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
<xsl:output method="html"/>
<xsl:decimal-format name="us" decimal-separator='.' grouping-separator=',' />
<xsl:decimal-format name="european" decimal-separator=',' grouping-
separator='.' />
<xsl:decimal-format name="example" decimal-separator="." grouping-
separator=","
infinity="INFINITY" minus-sign="-" NaN="Not a Number" percent="%"
per-mille="m" zero-digit="0" digit="#" pattern-separator=";" />
<xsl:template match="/">
<HTML><BODY>
<table border="1" cellpadding="2" cellspacing="0">
<tr align="center">
<td><b>Data</b></td>
<td><b>Default</b></td>
36
` SRM UNIVERSITY
Ramapuram Campus, Chennai-600089.
Department Of Computer Applications
<td><b>European</b></td>
<td><b>US</b></td>
<td><b>Example</b></td>
</tr>
<tr align="right">
<td>24535.2</td>
<td><xsl:value-of select="format-number(24535.2, '###,###.00')"/></td>
<td><xsl:value-of select="format-number(24535.2, '###.###,00',
'european')"/></td>
<td><xsl:value-of select="format-number(24535.2, '###,###.00', 'us')"/></td>
<td><xsl:value-of select="format-number(24535.2, '###,###.00',
'example')"/></td>
</tr>
</table>
</BODY></HTML>
</xsl:template>
</xsl:stylesheet>
37
` SRM UNIVERSITY
Ramapuram Campus, Chennai-600089.
Department Of Computer Applications
Output
Result
The formatting of XML/XSL is successfully completed
38
` SRM UNIVERSITY
Ramapuram Campus, Chennai-600089.
Department Of Computer Applications
Ex.No:8
XSL FORMATTING
Aim:
Algorithm:
Step-2: In the XML Document specify the .xsl file name in href.
Step-5: Create a Link with the XSLT document using href tag write the code:
Step-7: Then execute the xml file and view the output:
39
` SRM UNIVERSITY
Ramapuram Campus, Chennai-600089.
Department Of Computer Applications
<xsl:template match="person">
<p>
<xsl:copy-of select="given-name"/>
<xsl:text> </xsl:text>
<xsl:copy-of select="family-name"/>
</p>
</xsl:template>
</xsl:stylesheet>
40
` SRM UNIVERSITY
Ramapuram Campus, Chennai-600089.
Department Of Computer Applications
Output
Result
The formatting of XML/XSL is successfully completed
41
` SRM UNIVERSITY
Ramapuram Campus, Chennai-600089.
Department Of Computer Applications
Ex.No:. 9
XPATH IMPLEMENTATION
Algorithm:
42
` SRM UNIVERSITY
Ramapuram Campus, Chennai-600089.
Department Of Computer Applications
XPATH
<xsl:for-each select="order">
<b> order id: </b> <xsl:value-of select="@id"/> <br/>
Quantity <xsl:value-of select="@quantity"/> <br/>
order value <xsl:value-of select='(../@price)*(quantity)'/> <br/>
</xsl:for-each>
<HR/>
<b> Product Sales Value : <xsl:value-of
select='(./@price)*sum(./order/quantity)'/> </b> <br/> <hr/> <br/>
43
` SRM UNIVERSITY
Ramapuram Campus, Chennai-600089.
Department Of Computer Applications
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="xpat.xsl"?>
<purchase>
</product>
</purchase>
44
` SRM UNIVERSITY
Ramapuram Campus, Chennai-600089.
Department Of Computer Applications
Output
Result:
XML file executed successfully.
45
` SRM UNIVERSITY
Ramapuram Campus, Chennai-600089.
Department Of Computer Applications
Ex.No:.10
Algorithm :
Step 1:open notepad for creating a simple xml file.
Step 2: define element countries as root. Country and state as subelement.
Step 3: close the root element of .xml file and save it.
Step 4: Open another notepad for creating .html file for DOM class
Step 5: declare JavaScript as Script language and print the root and child
element of .xml file.
Step6. close all the subsequent elements tag.
Step 7: save the file with .html extension
Step 8: Open Browser and open the HTML file
46
` SRM UNIVERSITY
Ramapuram Campus, Chennai-600089.
Department Of Computer Applications
XML DOCUMENT CLASS
<?xml version="1.0"?>
<countries>
<country cname="India">
<state name="TamilNadu">TN</state>
<state name="Keral">TN</state>
<state name="Rajasthan">TN</state>
<state name="Assam">TN</state>
</country>
<html>
<body>
<SCRIPT LANGUAGE="JavaScript">
var xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.load("country.xml");
var root=xml.Doc.documentElement.lastChild.lastChild.previousSibling;
document.write("nodeType:"+root.nodeType+"<BR>");
document.write("nodeType:"+root.nodeName+"<BR>");
document.write("Text:"+root.text+"<BR>");
</SCRIPT>
</body>
</html>
47
` SRM UNIVERSITY
Ramapuram Campus, Chennai-600089.
Department Of Computer Applications
OUTPUT
Result:
XML file executed successfully.
48
` SRM UNIVERSITY
Ramapuram Campus, Chennai-600089.
Department Of Computer Applications
Ex.No:.11
Aim: To identify the error in the XML file using the XML parser error
functions.
Algorithm:
49
` SRM UNIVERSITY
Ramapuram Campus, Chennai-600089.
Department Of Computer Applications
<?xml version="1.0"?>
<countries>
<country cname="Canada">
<state name="India">IND</state>
<state name="Australia">AUS</state>
</country>
<country cname="United States">
<State name="Colorado">CO</state>
<state name="Delaware">DE</state>
</country>
</Countries>
<html>
<body>
<scrit language="JavaScript">
var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async=false;
xmlDoc.load("dom.xml");
if(xmlDoc.parseError.errorCode != 0)
{
document.writeln("Error" + xmlDoc.parseError.errorCode+"on line"
+xmlDoc.parseError.line+",position"+xmlDoc.parseError.linepos+"<BR><BR>
");
document.writeln(xmlDoc.parseError.reason+"<BR><BR>");
document.writeln(xmlDoc.parseError.srcText+"<BR><BR>");
}
</script>
</body>
</html>
50
` SRM UNIVERSITY
Ramapuram Campus, Chennai-600089.
Department Of Computer Applications
OUTPUT
Result:
XML file executed successfully.
51
` SRM UNIVERSITY
Ramapuram Campus, Chennai-600089.
Department Of Computer Applications
Ex.No:.12
Algorithm:
52
` SRM UNIVERSITY
Ramapuram Campus, Chennai-600089.
Department Of Computer Applications
<?xml version="1.0"?>
<addbook>
<details>
<name>John Smith</name>
<DOB>2-january-1978</DOB>
<city>Chennai</city>
<state>Tamilnadu</state>
<pincode>600089</pincode>
<work title="Project Manager" company="TCS" city="Chennai"></work>
<phoneno>984002561</phoneno>
<email>john@yahoo.in</email>
</details>
<details>
<name>Annie</name>
<DOB>30-March-1982</DOB>
<city>Ville Parle</city>
<state>Mumbai</state>
<pincode>876001</pincode>
<work title="HR" company="Wipro" city="Mumbai"></work>
<phoneno>9600560190</phoneno>
<email>annie@gmail.com</email>
</details>
</addbook>
53
` SRM UNIVERSITY
Ramapuram Campus, Chennai-600089.
Department Of Computer Applications
CODE for page Load
OUTPUT
Result:
XML file executed successfully.
54
` SRM UNIVERSITY
Ramapuram Campus, Chennai-600089.
Department Of Computer Applications
Ex.No:.13
WEB SERVICES
Algorithm:-
Step 1: Start
Step 2: Click on start | Go to Program | Go To Microsoft Visual Studio
2005 | Click On Microsoft Visual Studio 2005
55
` SRM UNIVERSITY
Ramapuram Campus, Chennai-600089.
Department Of Computer Applications
WEB SERVICES
{
return a * b;
}
CODE ON BUTTON
{
localhost.Service s = new localhost.Service();
int a= Int32.Parse(TextBox1.Text);
int b = Int32.Parse(TextBox2.Text);
int res = s.mul(a, b);
TextBox3.Text = res.ToString();
56
` SRM UNIVERSITY
Ramapuram Campus, Chennai-600089.
Department Of Computer Applications
OUTPUT
Result:
XML file executed successfully.
57