0% found this document useful (0 votes)
2 views

Web Lab XML Codes

The document contains an XML-based student catalogue with details of five students, including their names, ages, genders, courses, GPAs, emails, phone numbers, and addresses. It also includes an internal DTD defining the structure of the student elements and an external DTD file that specifies the required attributes and elements for the student data. Additionally, there is an example XML file that adheres to the external DTD format with two student entries.

Uploaded by

flipkartredeem
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Web Lab XML Codes

The document contains an XML-based student catalogue with details of five students, including their names, ages, genders, courses, GPAs, emails, phone numbers, and addresses. It also includes an internal DTD defining the structure of the student elements and an external DTD file that specifies the required attributes and elements for the student data. Additionally, there is an example XML file that adheres to the external DTD format with two student entries.

Uploaded by

flipkartredeem
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

STUDENT CATALOGUE USING XML

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

<StudentCatalogue>

<Student id="IND001">

<Name>Arjun Mehta</Name>

<Age>22</Age>

<Gender>Male</Gender>

<Courses>

<Course>Computer Science</Course>

<Course>Data Structures</Course>

<Course>Machine Learning</Course>

</Courses>

<GPA>8.7</GPA>

<Email>[email protected]</Email>

<Phone>+91-9876543210</Phone>

<Address>

<Street>12, Ring Road</Street>

<City>New Delhi</City>

<State>Delhi</State>

<Pincode>110001</Pincode>

</Address>

</Student>

<Student id="IND002">

<Name>Sneha Iyer</Name>

<Age>21</Age>

<Gender>Female</Gender>

<Courses>

<Course>Electrical Engineering</Course>

<Course>Digital Circuits</Course>

<Course>Embedded Systems</Course>
</Courses>

<GPA>9.1</GPA>

<Email>[email protected]</Email>

<Phone>+91-9823001234</Phone>

<Address>

<Street>45, Anna Salai</Street>

<City>Chennai</City>

<State>Tamil Nadu</State>

<Pincode>600020</Pincode>

</Address>

</Student>

<Student id="IND003">

<Name>Rahul Sharma</Name>

<Age>23</Age>

<Gender>Male</Gender>

<Courses>

<Course>Mechanical Engineering</Course>

<Course>Thermodynamics</Course>

<Course>Robotics</Course>

</Courses>

<GPA>8.4</GPA>

<Email>[email protected]</Email>

<Phone>+91-9988776655</Phone>

<Address>

<Street>22, Sector 17</Street>

<City>Jaipur</City>

<State>Rajasthan</State>

<Pincode>302004</Pincode>

</Address>

</Student>
<Student id="IND004">

<Name>Pooja Nair</Name>

<Age>20</Age>

<Gender>Female</Gender>

<Courses>

<Course>Information Technology</Course>

<Course>Cloud Computing</Course>

<Course>Cybersecurity</Course>

</Courses>

<GPA>9.3</GPA>

<Email>[email protected]</Email>

<Phone>+91-9101234567</Phone>

<Address>

<Street>67, MG Road</Street>

<City>Bangalore</City>

<State>Karnataka</State>

<Pincode>560001</Pincode>

</Address>

</Student>

<Student id="IND005">

<Name>Aditya Kulkarni</Name>

<Age>22</Age>

<Gender>Male</Gender>

<Courses>

<Course>Civil Engineering</Course>

<Course>Structural Analysis</Course>

<Course>Environmental Engineering</Course>

</Courses>

<GPA>8.9</GPA>
<Email>[email protected]</Email>

<Phone>+91-9090909090</Phone>

<Address>

<Street>88, FC Road</Street>

<City>Pune</City>

<State>Maharashtra</State>

<Pincode>411005</Pincode>

</Address>

</Student>

</StudentCatalogue>

INTERNAL DTD IN XML (STUDENT CATALOGUE)


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

<!DOCTYPE StudentCatalogue [

<!ELEMENT StudentCatalogue (Student+)>

<!ELEMENT Student (Name, Age, Gender, Course, GPA)>

<!ELEMENT Name (#PCDATA)>

<!ELEMENT Age (#PCDATA)>

<!ELEMENT Gender (#PCDATA)>

<!ELEMENT Course (#PCDATA)>

<!ELEMENT GPA (#PCDATA)>

]>

<StudentCatalogue>

<Student>

<Name>Aarav Singh</Name>

<Age>21</Age>

<Gender>Male</Gender>

<Course>Computer Science</Course>

<GPA>8.8</GPA>

</Student>

<Student>
<Name>Divya Patel</Name>

<Age>22</Age>

<Gender>Female</Gender>

<Course>Electronics</Course>

<GPA>9.2</GPA>

</Student>

</StudentCatalogue>

STEP 1: EXTERNAL DTD FILE (STUDENT.DTD)


<!-- student.dtd -->
<!ELEMENT StudentCatalogue (Student+)>
<!ELEMENT Student (Name, Age, Gender, Course, GPA)>
<!ATTLIST Student id ID #REQUIRED>
<!ELEMENT Name (#PCDATA)>
<!ELEMENT Age (#PCDATA)>
<!ELEMENT Gender (#PCDATA)>
<!ELEMENT Course (#PCDATA)>
<!ELEMENT GPA (#PCDATA)>

XML FILE USING THE DTD (STUDENT.XML)


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE StudentCatalogue SYSTEM "student.dtd">
<StudentCatalogue>
<Student id="S001">
<Name>Neha Verma</Name>
<Age>20</Age>
<Gender>Female</Gender>
<Course>Computer Science</Course>
<GPA>9.0</GPA>
</Student>
<Student id="S002">
<Name>Karan Joshi</Name>
<Age>22</Age>
<Gender>Male</Gender>
<Course>Mechanical Engineering</Course>
<GPA>8.5</GPA>
</Student>
</StudentCatalogue>

You might also like