For the fourth week, we were introduced to XML. XML stands for eXtensible Markup Language. This is a markup language because one can invent entities which mean something. Some research was made on XML using http://www.w3schools.com/xml. XML was designed to carry data and not to display. XML and HTML are different then each other, XML is used to store data while HTML is used to display data. In XML you predefine your own tags, there aren't tags that are XML standards. XML syntax are case sensitive.
XML documents starts with declaring the XML version. The first tag is the root element which describes what the document is.Example: <mail> that means that the document is a mail the next tags are the child elements of the root.
DTD which stands for document type definition describes the XML file, it defines the structure with a list of legal elements.
Task
This weeks task was to create a file about a school project having student name, student Id, project title, project category, abstract and date submitted. We had to try use both elements and attributes to describe the data. Then we had to validate the XML using a W3Schools Validator. After that create a DTD to describe the XML file and validate the DTD too.
XML Document
Above is the code for the XML document. The root element is the project element meaning that this document is about a project. Student is the child element of the project element and contains the student tag. Both attributes and element needed to be used so in student name and Id where used as the attributes of student. Each student will give the project a title, the category, abstract and what date it was submitted since each student will have a project.
DTD Schema
Both XML and DTD where tested in w3schools validators.
Schema
No comments:
Post a Comment