Ex 4

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 7

AIM:

To Write a XML, XML Schema, DTD for Loan Management System

PROBLEM STATEMENT:

Write a XML, DTD, XML Schema for chosen web application.

i. Identify the root element, element, sub element and attributes.


ii. Check well formedness and validity.
iii. Use of CDATA – fixed, implied and required.
iv. Use of complex and simple type (minimum two user defined data type).
Use of conditions in XSLT.

PROJECT CODE:

XML AND DTD:

<?xml version = "1.0"?>

<?xml-stylesheet type="text/xsl" href="xsl_register.xsl"?>

<!DOCTYPE register_list [

<!ELEMENT register_list (register+)>

<!ELEMENT register (name,email,address,mobile,password,confm_password,gender)>

<!ELEMENT name (#PCDATA)>

<!ELEMENT email (#PCDATA)>

<!ELEMENT address (#PCDATA)>

<!ELEMENT mobile (#PCDATA)>

<!ELEMENT password (#PCDATA)>

<!ELEMENT confmm_password (#PCDATA)>

<!ELEMENT gender (#PCDATA)>

]>
<register_list>

<register id="1">

<name>tobias eaton</name>

<email>tobiaseaton@hotmail.com</email>

<address>mystic falls</address>

<mobile>123456787</mobile>

<password>div125tobias</password>

<confm_password>div125tobias</confm_password>

<gender>male</gender>

</register>

<register id="2">

<name>Elliot Alderson</name>

<email>rami_melak@robot.com</email>

<address>Los Angelos</address>

<mobile>120505005</mobile>

<password>fsociety</password>

<confm_password>fsociety</confm_password>

<gender>male</gender>

</register>

<register id = "3">

<name>Hope mikaelson</name>

<email>kidvampire@vamp.com</email>

<address>New Orleans</address>

<mobile>01010101</mobile>

<password>tribrid_m</password>

<confm_password>tribrid_m</confm_password>

<gender>female</gender>
</register>

</register_list>

XSD:

<?xml version="1.0"?>

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"

elementFormDefault="qualified">

<xs:element name="register">

<xs:complexType>

<xs:sequence>

<xs:element name="name">

<xs:simpleType>

<xs:restriction base="xs:string">

<xs:minLength value="1">

<xs:maxLength value="20">

<xs:pattern value="[a-zA-Z]*"/>

</xs:restriction>

</xs:simpleType>

</xs:element>

<xs:element name="email">

<xs:simpleText>

<xs:restriction base="xs:string">

<xs:minLength value="1">

<xs:maxLength value="20">

<xs:pattern value="[a-zA-Z]*"/>

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

</xs:element>

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

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

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

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

<xs:element name="gender">

<xs:simpleType>

<xs:restriction base="xs:string">

<xs:enumeration value="male"/>

<xs:enumeration value="female"/>

<xs:enumeration value="others"/>

</xs:restriction>

</xs:simpleType>

</xs:element>

</xs:sequence>

</xs:complexType>

</xs:element>

</xs:schema>

XSL:

<?xml version="1.0"?>

<xsl:stylesheet version="1.0"

xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">

<html>

<body>
<h1><b>Registration</b></h1>

<center>

<table border="1">

<tr bgcolor="green">

<th>Name</th>

<th>Email</th>

<th>Address</th>

<th>Mobile</th>

<th>Password</th>

<th>Gender</th>

</tr>

<xsl:for-each select="register_list/register">

<tr>

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

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

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

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

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

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

</tr>

</xsl:for-each>

</table>

</center>

</body>

</html>

</xsl:template>
</xsl:stylesheet>

OUTPUT:

RESULT:
Thus the XML, XML Schema, DTD for the modules has been designed successfully.

You might also like