0% found this document useful (0 votes)
48 views7 pages

Ex 4

XML Program
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views7 pages

Ex 4

XML Program
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 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>[email protected]</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>[email protected]</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>[email protected]</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