Posts

Showing posts with the label XML programming

How to create XML file for employee management system and display it using CSS?

    Employees are working for many organizations. For maintaining the details,we need to collect the name,employee id,designation and salary details. Here,   we use CSS(Cascading Style sheets) to display XML files. For doing this,we need to open any text editor like notepad. Create two files   and name that as “employee.xml” and “employee.css” Add the following code. employee.xml <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/css" href="employee.css"?> <payroll>   <Heading> Welcome to the Employee management system </Heading>      <employee>           <name> adhav </name>            <id> Emp01   </id>            <Designation> Executive </Designation>     ...

How to create DTD for book details in a bookstore?

DTD(Document Type Declaration) is mainly used to describe xml.  The purpose of DTD is  to check vocabulary of the xml. It also checks the validity of the structure of XML documents. It has the syntax given below. Syntax: <!DOCTYPE element DTD identifier [   Declaration 1   Declaration 2     ………………   Declaration n   ]>   It has two types listed as follows. ·        ->  Internal DTD ·        -> External DTD First, how the internal DTD is created and used in XML is shown below… Internal DTD: This type of DTD is defined inside the XML file. We can use the above syntax here. In the XML declaration, set the standalone attribute to “yes”. The sample XML code for book store is given below.   <?xml version=”1.0” encoding=”UTF-8” standalone=”yes”?> <! DOCTYPE book [ <!ELEMENT book(name,author,publisher)> <!ELEMENT   name(#PC...

How to write your first XML program?

XML is Extensible Markup Language. It is used to create user defined tags. This is derived from SGML(Standard Generalized Markup Language). Do you like to create your own tags?? If the answer is yes, you try XML. A simple XML code is given below. It is a simple birthday message for your beloved one. < Birthday>   <Wishes>  Happy birthday  </Wishes> </Birthday>     Here, the root tag is <Birthday>. <Wishes>   is the user defined tag. This basic xml program shows you to create a root tag with elements. To create a basic program, follow the below syntax. Syntax: < ?xml version=”1.0”?> <root tag>   <element1>   </element1>                     .                     .   <elem...

How to create Xml for a book store application and display it?

Image
A book store has a collection of books with various categories. It includes fiction,non fiction based books, general books, Technical books. In  this example, the book store has computer science based books. Each book has a title,author(s),category it belongs, publications details and price of the book.The code is given below... XML program for book store application is given below.  <?xml version="1.0" encoding="UTF-8"?> <book_store> <book> <title>The art of computer programming</title> <author> Donald E.Knuth</author> <category> Computers</category> <publications> Addison wesley</publications> <price> 10,060</price> </book> <book> <title>Code </title> <author> Charles Petzold </author> <category> Coding </category> <publications> Microsoft Press</publications> <price> 1500</price> </book> <book> <titl...

How to create a XML DTD for displaying student details

Image
XML  is    e X tensible M arkup L anguage which is used to create used defined tags.  It has Elements  ( <STUDENT>) Attributes (<STUDENT id="21it21">) To create a XML file, create three files 1 ->  XML file (used to declare the user defined tags) 2 ->  DTD file (used to define the user defined tags) 3 ->  HTML file(used to display the xml file as web page) create these three files using any editor like notepad.  Student.Xml <?xml version="1.0"?> <!DOCTYPE STUDENTS SYSTEM "E:\XML1\STUDENT.dtd"> <STUDENTS>  <STUDENT>  <STUDENTDATA>     <NAME> SUTHA </NAME>     <ID>  2007IT51 </ID>     <AGE> 20 </AGE>     <ADDRESS> 12, SATHY ROAD , GOBI </ADDRESS>   </STUDENTDATA> </STUDENT> </STUDENTS> Student.dtd <?xml version="1.0"?> <!ELEMENT STU...