28
WWW.VIDYARTHIPLUS.COM MC7511EX.NO: XML DOCUMENT CREATION DATE: AIM: To write a program to create xml document using XML language. PROCEDURE: STEP 1: Start the process STEP 2: Create the xml document using notepad. STEP 3: Save the xml document as .xml extension STEP 4: Then move to the location and double click on the saved document. CODING: <?xml version="1.0" encoding="UTF-8"?> <breakfast_menu> <food> <name>Belgian Waffles</name> <price>$5.95</price> <description>Two of our famous Belgian Waffles with plenty of real maple syrup</description> <calories>650</calories> </food> <food> <name>Strawberry Belgian Waffles</name> <price>$7.95</price> <description>Light Belgian waffles covered with strawberries and whipped cream</description> <calories>900</calories> </food> <food>

MC7511EX.NO: XML DOCUMENT CREATION

  • Upload
    others

  • View
    8

  • Download
    0

Embed Size (px)

Citation preview

Page 1: MC7511EX.NO: XML DOCUMENT CREATION

WWW.VIDYARTHIPLUS.COM

MC7511EX.NO: XML DOCUMENT CREATION

DATE:

AIM:

To write a program to create xml document using XML language.

PROCEDURE:

STEP 1: Start the process

STEP 2: Create the xml document using notepad.

STEP 3: Save the xml document as .xml extension

STEP 4: Then move to the location and double click on the saved document.

CODING:

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

<breakfast_menu>

<food>

<name>Belgian Waffles</name>

<price>$5.95</price>

<description>Two of our famous Belgian Waffles with plenty of real maple syrup</description>

<calories>650</calories>

</food>

<food>

<name>Strawberry Belgian Waffles</name>

<price>$7.95</price>

<description>Light Belgian waffles covered with strawberries and whipped cream</description>

<calories>900</calories>

</food>

<food>

Page 2: MC7511EX.NO: XML DOCUMENT CREATION

WWW.VIDYARTHIPLUS.COM

<name>Berry-Berry Belgian Waffles</name>

<price>$8.95</price>

<description>Light Belgian waffles covered with an assortment of fresh berries and whipped

cream</description>

<calories>900</calories>

</food>

<food>

<name>French Toast</name>

<price>$4.50</price>

<description>Thick slices made from our homemade sourdough

bread</description>

<calories>600</calories>

</food>

<food>

<name>Homestyle Breakfast</name>

<price>$6.95</price>

<description>Two eggs, bacon or sausage, toast, and our ever-popular hash

browns</description>

<calories>950</calories>

</food>

</breakfast_menu>

RESULT:

Thus the above XML document creation program has been executed successfully.

Page 3: MC7511EX.NO: XML DOCUMENT CREATION

WWW.VIDYARTHIPLUS.COM

EX.NO: IMPORTING AND EXPORTING XML DOCUMENT

DATE:

AIM:

To write a program to import and export xml document using Microsoft access and

Microsoft excel.

PROCEDURE:

FOR MICROSOFT ACCESS

STEP 1: Start the process

STEP 2: Create the xml document using notepad.

STEP 3: Save the xml document as .xml extension

STEP 4: Click start->All programs->Microsoft office->Microsoft access 2007

STEP 5: To import the created xml document click->External data tab and XML option.

STEP 6: Browse the location of xml document and click ok

STEP 7: Display the table

STEP 8: To export xml document click->External Data->more->XML file.

STEP 9: Then browse the location to save the document and click ok.

FOR MICROSOFT EXCEL

STEP 1: Start the process

STEP 2: Create the xml document using notepad.

STEP 3: Save the xml document as .xml extension

STEP 4: Click start->All programs->Microsoft office->Microsoft Excel 2007

STEP 5: To import the xml document click->Data tab ->From Other Sources->From xml data

import.

STEP 6: Browse the location of xml document and click ok

STEP 7: View the table

STEP 8: Stop the process.

Page 4: MC7511EX.NO: XML DOCUMENT CREATION

WWW.VIDYARTHIPLUS.COM

CODING:

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

<shopping>

<Item1>

<itemname>Mobile</itemname>

<itemid>562</itemid>

<itemprice>15000</itemprice>

</Item1>

<custdetail1>

<custname>Geetha.M</custname>

<custid>1456</custid>

<custloc>Coimbatore</custloc>

</custdetail1>

<Item2>

<itemname>Pendrive</itemname>

<itemid>455</itemid>

<itemprice>500</itemprice>

</Item2>

<custdetail2>

<custname>Sathya.R</custname>

<custid>1456</custid>

<custloc>Chennai</custloc>

</custdetail2>

<Item3>

<itemname>Laptop</itemname>

Page 5: MC7511EX.NO: XML DOCUMENT CREATION

WWW.VIDYARTHIPLUS.COM

<itemid>5623</itemid>

<itemprice>15000</itemprice>

</Item3>

<custdetail3>

<custname>Divya.S</custname>

<custid>1589</custid>

<custloc>Bangalore</custloc>

</custdetail3>

</shopping>

Page 6: MC7511EX.NO: XML DOCUMENT CREATION

WWW.VIDYARTHIPLUS.COM

OUTPUT:

Page 7: MC7511EX.NO: XML DOCUMENT CREATION

WWW.VIDYARTHIPLUS.COM

Page 8: MC7511EX.NO: XML DOCUMENT CREATION

WWW.VIDYARTHIPLUS.COM

RESULT:

Thus the above importing and exporting xml document program has been executed

successfully.

Page 9: MC7511EX.NO: XML DOCUMENT CREATION

WWW.VIDYARTHIPLUS.COM

EX .NO: XSL TRANSFORMATION

DATE:

AIM:

To write a program to perform xml transformation using xml and xsl coding.

PROCEDURE:

STEP 1: Start the process.

STEP2: Create the xml and xsl document using notepad.

STEP3: Save the xml document as .xml and xsl document as .xsl extension

STEP4: Then move to the location and double click on the saved document.

STEP5: Stop the process.

CODING:

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>

Page 10: MC7511EX.NO: XML DOCUMENT CREATION

WWW.VIDYARTHIPLUS.COM

<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>

<artist>Gary Moore</artist>

<country>UK</country>

<company>Virgin records</company>

<price>10.20</price>

<year>1990</year>

</cd>

<cd>

<title>Eros</title>

Page 11: MC7511EX.NO: XML DOCUMENT CREATION

WWW.VIDYARTHIPLUS.COM

<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>

Page 12: MC7511EX.NO: XML DOCUMENT CREATION

WWW.VIDYARTHIPLUS.COM

<country>UK</country>

<company>Pickwick</company>

<price>8.50</price>

<year>1990</year>

</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>

Page 13: MC7511EX.NO: XML DOCUMENT CREATION

WWW.VIDYARTHIPLUS.COM

<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>

<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>

Page 14: MC7511EX.NO: XML DOCUMENT CREATION

WWW.VIDYARTHIPLUS.COM

<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>Jorn Hoel</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>

Page 15: MC7511EX.NO: XML DOCUMENT CREATION

WWW.VIDYARTHIPLUS.COM

<year>1990</year>

</cd>

<cd>

<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>

Page 16: MC7511EX.NO: XML DOCUMENT CREATION

WWW.VIDYARTHIPLUS.COM

</cd>

<cd>

<title>Midt om natten</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>

<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>

Page 17: MC7511EX.NO: XML DOCUMENT CREATION

WWW.VIDYARTHIPLUS.COM

<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>

Page 18: MC7511EX.NO: XML DOCUMENT CREATION

WWW.VIDYARTHIPLUS.COM

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>

<body>

<h2>My CD Collection</h2>

<table border="1">

<tr bgcolor="#9acd32">

<th style="text-align:left">Title</th>

<th style="text-align:left">Artist</th>

</tr>

<xsl:for-each select="catalog/cd">

<tr>

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

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

</tr>

</xsl:for-each>

</table>

</body>

</html>

</xsl:template>

</xsl:stylesheet>

Page 19: MC7511EX.NO: XML DOCUMENT CREATION

WWW.VIDYARTHIPLUS.COM

OUTPUT:

RESULT:

Thus the above XSL transformation program has been executed successfully.

Page 20: MC7511EX.NO: XML DOCUMENT CREATION

WWW.VIDYARTHIPLUS.COM

EX.NO: XML SCHEMA CREATION

DATE:

AIM:

To write a program to create XML Schema document.

PROCEDURE:

STEP 1: Start the process

STEP 2: Create the xml document using notepad.

STEP 3: Save the xml document as .xml extension

STEP 4: Then move to the location and double click on the saved document.

CODING:

XML:

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

<!-- Created with Liquid XML Studio 0.9.14.0 (http://www.liquid-technologies.com) -->

<SalesCatalogue>

<Product>

<Name>Transformers T-Shirt</Name>

<Description>

This Transformers Autobot T-shirt is black and made from 100% cotton.

The distressed image featured on the front of this t-shirt is of the Transformers Autobot.

</Description>

<Price>17.95</Price>

<ProductCode>52-2436556</ProductCode>

<Size>Big</Size>

</Product>

Page 21: MC7511EX.NO: XML DOCUMENT CREATION

WWW.VIDYARTHIPLUS.COM

</SalesCatalogue>

XML SCHEMA:

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

<xs:schema

attributeFormDefault="unqualified"elementFormDefault="qualified"xmlns:xs="http://w

ww.w3.org/2001/XMLSchema">

<xs:element name="SalesCatalogue">

<xs:complexType>

<xs:sequence>

<xs:element name="Product">

<xs:complexType>

<xs:sequence>

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

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

<xs:element name="Price" type="xs:decimal" />

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

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

</xs:sequence>

</xs:complexType>

</xs:element>

</xs:sequence>

</xs:complexType>

</xs:element>

</xs:schema>

Page 22: MC7511EX.NO: XML DOCUMENT CREATION

WWW.VIDYARTHIPLUS.COM

OUTPUT:

XML validation started.

Checkingfile:/C:/Documents%20and%20Settings/PGStudent/My%20Documents/NetBeansProje

cts/schema/newXMLDocument.xml...

XML validation finished.

RESULT:

Thus the above XML Schema Creation program has been executed successfully.

Page 23: MC7511EX.NO: XML DOCUMENT CREATION

WWW.VIDYARTHIPLUS.COM

Page 24: MC7511EX.NO: XML DOCUMENT CREATION

WWW.VIDYARTHIPLUS.COM

Page 25: MC7511EX.NO: XML DOCUMENT CREATION

WWW.VIDYARTHIPLUS.COM

Page 26: MC7511EX.NO: XML DOCUMENT CREATION

WWW.VIDYARTHIPLUS.COM

Page 27: MC7511EX.NO: XML DOCUMENT CREATION

WWW.VIDYARTHIPLUS.COM

Page 28: MC7511EX.NO: XML DOCUMENT CREATION

WWW.VIDYARTHIPLUS.COM