Professional Documents
Culture Documents
WDM Practical Vedant
WDM Practical Vedant
GANDHINAGAR
Department of
Computer Engineering and
Information Technology
Management(IT701-N)
Laboratory Manual
Prepared By
Class: 7 IT-I
LDRP-ITR 1
Web Data Management (IT701-N) 20BEIT30041
GANDHINAGAR
INFORMATION TECHNOLOGY
CERTIFICATE
Date: 14/10/23
LDRP-ITR 2
Web Data Management (IT701-N) 20BEIT30041
Index
LDRP-ITR
3
Web Data Management (IT701-N) 20BEIT30041
Practical-1
</person>
<email>aquastyle0909@gmail.com</email>
<user-rating>4.5</user-rating>
<completed-rides>10</completed-rides>
<upcoming-rides>1</upcoming-rides>
<image
url="https://images.app.goo.gl/stkiXhKomLW3gWvz8">Logo</image>
<payment-methods>
<method-1>Debit card</method-1>
<method-1>Credit card</method-1>
<method-1>Online Payment Wallets</method-1>
</payment-methods>
<address>
<home-address>Home</home-address>
<work-address>Work</work-address>
</address>
<Security>Password and 2 factor authentication</Security>
<maps-used>Google maps</maps-used>
<app-version>4.346.10006</app-version>
LDRP-ITR
4
Web Data Management (IT701-N) 20BEIT30041
</uber-system>
<keep-notes>
<person>
<firstname>Raj</firstname>
<lastname>Patel</lastname>
</person>
<email>rajp23232@hotmail.com</email>
<notes>34</notes>
<labels>
<android>Android course</android>
<java>Java course</java>
<python>Python course</python>
<JavaScript>Java script</JavaScript>
<Ruby>Ruby course</Ruby>
</labels>
<archived-notes>2</archived-notes>
<pinned-notes>1</pinned-notes>
<notes-in-bin>3</notes-in-bin>
<reminder>
<reminder-1>Attend a seminar</reminder-1>
LDRP-ITR
5
Web Data Management (IT701-N) 20BEIT30041
Practical-2
Aim: Create a DTD file for large XML Dataset.
<?xml encoding="UTF-8"?>
<!ATTLIST uber-system
xmlns CDATA #FIXED ''>
LDRP-ITR
6
Web Data Management (IT701-N) 20BEIT30041
LDRP-ITR
7
Web Data Management (IT701-N) 20BEIT30041
<!ATTLIST python
xmlns CDATA #FIXED ''>
LDRP-ITR
9
Web Data Management (IT701-N) 20BEIT30041
Practical-3
<xs:element name="mobile-apps">
<xs:complexType>
<xs:sequence>
<xs:element ref="uber-system"/>
<xs:element ref="keep-notes"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="uber-system">
<xs:complexType>
<xs:sequence>
<xs:element ref="person"/>
<xs:element ref="email"/>
<xs:element ref="user-rating"/>
<xs:element ref="completed-rides"/>
<xs:element ref="upcoming-rides"/>
<xs:element ref="image"/>
<xs:element ref="payment-methods"/>
<xs:element ref="address"/>
<xs:element ref="Security"/>
<xs:element ref="maps-used"/>
<xs:element ref="app-version"/>
</xs:sequence>
</xs:complexType>
LDRP-ITR
10
Web Data Management (IT701-N) 20BEIT30041
</xs:element>
<xs:element name="user-rating" type="xs:decimal"/>
<xs:element name="completed-rides" type="xs:integer"/>
<xs:element name="upcoming-rides" type="xs:integer"/>
<xs:element name="image">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:NCName">
<xs:attribute name="url" use="required" type="xs:anyURI"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="payment-methods">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" ref="method-1"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="method-1" type="xs:string"/>
<xs:element name="address">
<xs:complexType>
<xs:sequence>
<xs:element ref="home-address"/>
<xs:element ref="work-address"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="home-address" type="xs:NCName"/>
<xs:element name="work-address" type="xs:NCName"/>
LDRP-ITR
11
Web Data Management (IT701-N) 20BEIT30041
<xs:complexType>
<xs:sequence>
<xs:element ref="person"/>
<xs:element ref="email"/>
<xs:element ref="notes"/>
<xs:element ref="labels"/>
<xs:element ref="archived-notes"/>
<xs:element ref="pinned-notes"/>
<xs:element ref="notes-in-bin"/>
<xs:element ref="reminder"/>
<xs:element ref="app-version"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:complexType>
</xs:element>
<xs:element name="android" type="xs:string"/>
LDRP-ITR
12
Web Data Management (IT701-N) 20BEIT30041
<xs:sequence>
<xs:element ref="reminder-1"/>
<xs:element ref="reminder-2"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="reminder-1" type="xs:string"/>
<xs:element name="reminder-2" type="xs:string"/>
<xs:element name="person">
<xs:complexType>
<xs:sequence>
<xs:element ref="firstname"/>
<xs:element ref="lastname"/>
<xs:element minOccurs="0" ref="gender"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="firstname" type="xs:NCName"/>
<xs:element name="lastname" type="xs:NCName"/>
<xs:element name="gender" type="xs:NCName"/>
<xs:element name="email" type="xs:string"/>
<xs:element name="app-version" type="xs:NMTOKEN"/>
LDRP-ITR
13
Web Data Management (IT701-N) 20BEIT30041
</xs:schema>
LDRP-ITR
14
Web Data Management (IT701-N) 20BEIT30041
Practical-4
Aim: Create a XSL Script for large XML Dataset to display data different
way.
XSL File:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="employee">
<html>
<body>
<h1>Employee Data</h1>
<tr>
<td>First Name</td>
<td>Last Name</td>
<td>Email</td>
<td>City</td>
<td>Age</td>
<td>Birth Date</td>
<td>Joining Date</td>
<td>Department</td>
<td>Job Post</td>
LDRP-ITR
15
Web Data Management (IT701-N) 20BEIT30041
</tr>
<xsl:for-each select="id">
<tr>
<xsl:for-each select="department">
<xsl:choose>
<td>Researcher</td>
</xsl:when>
<td>Coder</td>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</tr>
LDRP-ITR
16
Web Data Management (IT701-N) 20BEIT30041
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
XML File:
<employee>
<id>
<firstname>Purvesh</firstname>
<lastname>Patel</lastname>
<email>purvesh@gmail.com</email>
<address>Ahmedabad</address>
<age>21</age>
<bdate>1999-11-05</bdate>
<join>2019-09-28</join>
<department type="research">RnD</department>
</id>
LDRP-ITR
17
Web Data Management (IT701-N) 20BEIT30041
<id>
<firstname>Pari</firstname>
<lastname>Nimavat</lastname>
<email>pari@gmail.com</email>
<address>Ahmedabad</address>
<age>20</age>
<bdate>2000-04-28</bdate>
<join>2019-09-28</join>
<department type="research">RnD</department>
</id>
<id>
<firstname>Umang</firstname>
<lastname>Patel</lastname>
<email>umang@gmail.com</email>
<address>Mumbai</address>
<age>21</age>
<bdate>1999-11-25</bdate>
<join>2019-09-28</join>
<department type="coding">Development</department>
</id>
<id>
<firstname>Harsh</firstname>
LDRP-ITR
18
Web Data Management (IT701-N) 20BEIT30041
<lastname>Pandya</lastname>
<email>harsh@gmail.com</email>
<address>Ahmedabad</address>
<age>20</age>
<bdate>2000-09-07</bdate>
<join>2019-09-28</join>
<department type="coding">Tester</department>
</id>
<id>
<firstname>Milan</firstname>
<lastname>Patel</lastname>
<email>milan@gmail.com</email>
<address>Mumbai</address>
<age>21</age>
<bdate>1999-04-15</bdate>
<join>2019-09-28</join>
<department type="coding">Tester</department>
</id>
</employee>
LDRP-ITR
19
Web Data Management (IT701-N) 20BEIT30041
Practical-5
XML File:
<employee>
<id>
<firstname>Purvesh</firstname>
<lastname>Patel</lastname>
<email>purvesh@gmail.com</email>
<address>Ahmedabad</address>
<age>21</age>
<bdate>1999-11-05</bdate>
<join>2019-09-28</join>
<department type="research">RnD</department>
</id>
<id>
<firstname>Pari</firstname>
<lastname>Nimavat</lastname>
<email>pari@gmail.com</email>
<address>Ahmedabad</address>
<age>20</age>
LDRP-ITR
20
Web Data Management (IT701-N) 20BEIT30041
<bdate>2000-04-28</bdate>
<join>2019-09-28</join>
<department type="research">RnD</department>
</id>
<id>
<firstname>Umang</firstname>
<lastname>Patel</lastname>
<email>umang@gmail.com</email>
<address>Mumbai</address>
<age>21</age>
<bdate>1999-11-25</bdate>
<join>2019-09-28</join>
<department type="coding">Development</department>
</id>
<id>
<firstname>Harsh</firstname>
<lastname>Pandya</lastname>
<email>harsh@gmail.com</email>
<address>Ahmedabad</address>
<age>20</age>
<bdate>2000-09-07</bdate>
<join>2019-09-28</join>
LDRP-ITR
21
Web Data Management (IT701-N) 20BEIT30041
<department type="coding">Tester</department>
</id>
<id>
<firstname>Milan</firstname>
<lastname>Patel</lastname>
<email>milan@gmail.com</email>
<address>Mumbai</address>
<age>21</age>
<bdate>1999-04-15</bdate>
<join>2019-09-28</join>
<department type="coding">Tester</department>
</id>
</employee>
//address[contains(text(),"Ahmedabad")]
LDRP-ITR
23
Web Data Management (IT701-N) 20BEIT30041
Practical-6
XMLfile:
<bookstore>
<bookcategory="fiction">
<title>TheGreatGatsby</title>
<author>F.ScottFitzgerald</author>
<price>10.99</price>
</book>
<bookcategory="non-fiction">
<title>TheElementsofStyle</title>
<author>WilliamStrunkJr.</author>
<author>E.B.White</author>
<price>9.99</price>
</book>
</bookstore>
If you wanted to select only the "author" elements that are direct children of the
"book" elements, you could use the "child" axis, like this:
/bookstore/book/author
LDRP-ITR
24
Web Data Management (IT701-N) 20BEIT30041
Practical-7
XML File:
<books>
<book>
<title>TheGreatGatsby</title>
<author>F.ScottFitzgerald</author>
<year>1925</year>
<publisher>CharlesScribner'sSons</publisher>
</book>
<book>
<title>ToKillaMockingbird</title>
<author>HarperLee</author>
<year>1960</year>
<publisher>J.B.Lippincott &Co.</publisher>
</book>
<!--morebooks-->
</books>
You could use the following XPath statement to select all the "book" elements in
the XMLfile:
/books/book
LDRP-ITR
25
Web Data Management (IT701-N) 20BEIT30041
Practical-8
XML File:
<?xml version="1.0"?>
<catalog>
<book id="bk101">
<author>Gambardella, Matthew</author>
<title>XML Developer's Guide</title>
<genre>Computer</genre>
<price>44.95</price>
<publish_date>2000-10-01</publish_date>
<description>An in-depth look at creating applications with
XML.</description>
</book>
<book id="bk102">
<author>Ralls, Kim</author>
<title>Midnight Rain</title>
<genre>Fantasy</genre>
<price>5.95</price>
<publish_date>2000-12-16</publish_date>
<description>A former architect battles corporate zombies, an evil
sorceress, and her own childhood to become queen of the
world.</description>
</book>
<book id="bk103">
<author>Corets, Eva</author>
<title>Maeve Ascendant</title>
<genre>Fantasy</genre>
<price>5.95</price>
<publish_date>2000-11-17</publish_date>
LDRP-ITR
26
Web Data Management (IT701-N) 20BEIT30041
<book id="bk107">
<author>Thurman, Paula</author>
<title>Splish Splash</title>
<genre>Romance</genre>
<price>4.95</price>
<publish_date>2000-11-02</publish_date>
<description>A deep sea diver finds true love twenty thousand
leagues beneath the sea.</description>
</book>
<book id="bk108">
<author>Knorr, Stefan</author>
<title>Creepy Crawlies</title>
<genre>Horror</genre>
<price>4.95</price>
<publish_date>2000-12-06</publish_date>
<description>An anthology of horror stories about roaches, centipedes,
scorpions and other insects.</description>
</book>
<book id="bk109">
<author>Kress, Peter</author>
<title>Paradox Lost</title>
<genre>Science Fiction</genre>
<price>6.95</price>
<publish_date>2000-11-02</publish_date>
<description>After an inadvertant trip through a Heisenberg
Uncertainty Device, James Salway discovers the problems of being
quantum.</description>
</book>
<book id="bk110">
<author>O'Brien, Tim</author>
<title>Microsoft .NET: The Programming Bible</title>
<genre>Computer</genre>
<price>36.95</price>
<publish_date>2000-12-09</publish_date>
LDRP-ITR
28
Web Data Management (IT701-N) 20BEIT30041
LDRP-ITR
29
Web Data Management (IT701-N) 20BEIT30041
LDRP-ITR
31
Web Data Management (IT701-N) 20BEIT30041
Practical-9
Books.xml
<?xml version="1.0"?>
<catalog>
<book id="bk101">
<author>Gambardella, Matthew</author>
<title>XML Developer's Guide</title>
<genre>Computer</genre>
<price>44.95</price>
</book>
<book id="bk102">
<author>Ralls, Kim</author>
<title>Midnight Rain</title>
<genre>Fantasy</genre>
<price>5.95</price>
</book>
<book id="bk103">
<author>Corets, Eva</author>
<title>Maeve Ascendant</title>
<genre>Fantasy</genre>
<price>5.95</price>
</book>
<book id="bk104">
<author>Corets, Eva</author>
<title>Oberon's Legacy</title>
<genre>Fantasy</genre>
<price>5.95</price>
</book>
<book id="bk105">
<author>Corets, Eva</author>
LDRP-ITR
32
Web Data Management (IT701-N) 20BEIT30041
<book id="bk106">
<author>Randall, Cynthia</author>
<title>Lover Birds</title>
<genre>Romance</genre>
<price>4.95</price>
</book>
<book id="bk107">
<author>Thurman, Paula</author>
<title>Splish Splash</title>
<genre>Romance</genre>
<price>4.95</price>
</book>
<book id="bk108">
<author>Knorr, Stefan</author>
<title>Creepy Crawlies</title>
<genre>Horror</genre>
<price>4.95</price>
</book>
<book id="bk109">
<author>Kress, Peter</author>
<title>Paradox Lost</title>
<genre>Science Fiction</genre>
<price>6.95</price>
</book>
<book id="bk110">
<author>O'Brien, Tim</author>
<title>Microsoft .NET: The Programming Bible</title>
<genre>Computer</genre>
<price>36.95</price>
LDRP-ITR
33
Web Data Management (IT701-N) 20BEIT30041
</book>
<book id="bk111">
<author>O'Brien, Tim</author>
<title>MSXML3: A Comprehensive Guide</title>
<genre>Computer</genre>
<price>36.95</price>
</book>
<book id="bk112">
<author>Galos, Mike</author>
<title>Visual Studio 7: A Comprehensive Guide</title>
<genre>Computer</genre>
<price>49.95</price>
</book>
</catalog>
Book_info.xml
<?xml version="1.0"?>
<catalog>
<book id="bk101">
<title>XML Developer's Guide</title>
<publish_date>2000-10-01</publish_date>
<description>An in-depth look at creating applications with
XML.</description>
</book>
<book id="bk102">
<title>Midnight Rain</title>
<publish_date>2000-12-16</publish_date>
<description>A former architect battles corporate zombies, an evil
sorceress, and her own childhood to become queen of the
world.</description>
</book>
<book id="bk103">
<title>Maeve Ascendant</title>
<publish_date>2000-11-17</publish_date>
LDRP-ITR
34
Web Data Management (IT701-N) 20BEIT30041
Join Query:
<catalog>{ f
LDRP-ITR
36
Web Data Management (IT701-N) 20BEIT30041
or
$i in doc('./books.xml')/catalog/book,
$c in doc('./books_info.xml')/catalog/book
where
$i/title = $c/title and
$i/price >= 30
order by
$i/title
return
<book>
<title>{ $i/title }</title>
<publish_date>{ $c/publish_date }</publish_date>
<price>{ $i/price }</price>
</book>
}
</catalog>
Output:
<catalog>
<book>
<title>XML Developer's Guide</title>
<publish_date>2000-10-01</publish_date>
<price>44.95</price>
</book>
<book>
<title>Microsoft .NET: The Programming Bible</title>
<publish_date>2000-12-09</publish_date>
<price>36.95</price>
</book>
<book>
<title>MSXML3: A Comprehensive Guide</title>
LDRP-ITR
37
Web Data Management (IT701-N) 20BEIT30041
<publish_date>2000-12-01</publish_date>
<price>36.95</price>
</book>
<book>
<title>Visual Studio 7: A Comprehensive Guide</title>
<publish_date>2001-04-16</publish_date>
<price>49.95</price>
</book>
</catalog>
Group Query:
<catalog>{
for $g in doc('./books.xml')/catalog/book group by
$g/genre
return <books genre={$g/genre} count={count($g/genre)} />
}
</catalog>
Output:
<catalog>
<book genre="Computer" count="4" />
<book genre="Fantasy" count="4" />
<book genre="Romance" count="2" />
<book genre="Horror" count="1" />
<book genre="Science Fiction" count="1" />
</catalog>
LDRP-ITR
38
Web Data Management (IT701-N) 20BEIT30041
Practical-10
publicclassHelloWebService{
publicStringsayHello(Stringname){
return"Hello," +name+“!”;
}
}
LDRP-ITR
39
Web Data Management (IT701-N) 20BEIT30041
LDRP-ITR
40