Discussion: DTD and XML Schema
DTD
DTD is Document Type Definition. I learned little bit about DTD during the first lab. In this lab, I got a chance to learn more DTD. However, I am not able to complete whole tutorial of DTD. So far, I learn that DTD define legal building block of xml documents. We can declare DTD Internally and externally. If we declare internally, it should look like that
<! DOCTYPE root-element [element-declarations]>
. If we declare externally, it will appear like that
<! DOCTYPE root-element SYSTEM "filename">
I think that now is a good time to talk about the format of XML/HTML document which consider valid by DTD. The documents are made by Elements, Attributes, Entities, PCDATA, and CDATA. From DTD and XML tutorial I learned that every XML document must have one root element. If we look at a code which is given below, we can see note is a root element. This root element contains four elements, to, from, heading, and body. These all elements are PCDATA type. We declare element type under the DTD. This is an example of internal DTD. We can make this code external DTD by just putting element type portion of this code to separate file. Then mention that file name in the main code.
<?xml version="1.0"?>
<!DOCTYPE note [
<!ELEMENT note (to,from,heading,body)>
<!ELEMENT to (#PCDATA)>
<!ELEMENT from (#PCDATA)>
<!ELEMENT heading (#PCDATA)>
<!ELEMENT body (#PCDATA)>
]>
<note>
<to>Sandeep</to>
<from>Jenny</from>
<heading>Second Lab </heading>
<body>Don't forget to submit the Rough Draft</body>
</note>
XML Schema
XML Schema, like DTD, is used to define the legal building blocks of an XML. XML Schema supports data type. It is very powerful resource because it converts data between different data type very easily. In addition, it is written in XML, and it secures data communication. For example, In US, we write the date like that “11-02-2008” means Nov 2, 2008, but in India, people write the date in opposite way such as “02-11-2008” means 2 Nov, 2008. However, XML data type does not let people of both countries get confused. This is because XML date type “date” requires the format “ YYYY-MM-DD”. The example of data type is given below:-
<date type="date">2004-03-11</date>
In XML Schema,
element is the root element of every XML Schema. It has two types, simple type and complex type. In a simple type, element contains only text, and it can’t contain any other elements or attributes. In contrast, complex element contains other elements and attributes. The below is given an example of simple and complex type:-
Simple Type: xxx is the name of the element and yyy is the data type of the element.
<xs:element name="xxx" type="yyy"/>
Complex Type: in the code, person is the element which contains other elements, firstname and lastname.
<xs:element name="person">
<xs:complexType>
<xs:sequence>
<xs:element name="firstname" type="xs:string"/>
<xs:element name="lastname" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
I will compare different kinds of complex type and simple type by using mind mapping techniques in the next section (mind1, mind2).
In XML Schema, we have many data types such as string, date, and numeric. These data type help to organize our code.
Compare Validation of DTD,XML Schemas,HTML,and XHTML
The validation process of HTML and XHTML is not very different conceptually. I see only one difference between them, and it is that I was able to validate my page without adding paragraph tag by HTML but not by XHTML. This shows that XHTML is more strict than HTML in a case of tags. After validating my webpage, I think I should try to validate some of the website. Then I choose the same website which I chose for HTML validation such as yahoo and Google. With XHTML validation, I still get errors when I try to validation yahoo and Google. However, I got more error with XHTML validation comparison of HTML validation. These errors included most the error which I got when I tried to validate these two website by HTML. Again, I come up to conclusion that XHTML is more strict than HTML. That is why we got more errors with XHTML validation. If we compare XHTML validation compare to compilation, and then I say the same thing which says about HTML validation. XHTML and HTML validation help to figure about only syntax; on the other hand, compilation will allow finding syntax and other errors.
The both DTD and XML Schema are validating xml documents. The difference between both of them is the way they handle the information in order to validate xml documents. I think that as xml schema itself is an xml, the schema validation will take more time as it has to recursively check whether xsd is conforming to DTD, and as DTD is purely a raw format that might be faster. The validation for DTDs is built into Parsers;it is checked as the DTD is read. Presumably this would happen in an extremely optimized XML Schema validator as well-- it would not actually use the XMLSchema.In addition, DTD is limited in several areas including no support for namespaces, it is not well-formed, and it contains virtually no support for data types. However, DTDs do have several good qualities. For example, their syntax is very compact and easy to learn once the appropriate keywords are known. DTDs are also very good at validating an XML document's structure, meaning that element and attribute names can be checked and parent/child relationships among elements can be ensured. DTDs also provide support for entities. One of the biggest arguments in favor of DTDs is that the majority of validating XML parsers allow for validation against DTDs.
Mind Map
XML Schema:Simple Version
* XML_Schema.jpeg:
XML Schema: Complex Version
* XML_Schema1.jpeg:
DTD Mind Map
- DTD.jpeg:
Abstract Object
It is generally considered that every object is either abstract or concrete. The abstract-concrete distinction is often introduced and initially understood in terms of paradigmatic examples of objects of each kind. For example, Abstract is tennis, and concrete is a tennis player. In addition, an object is abstract if and only if it lacks a location in space
Beyond Schemas: Planning Your XML Model by Jennifer Linton.
* Twiki_Tools_.jpeg:
Reflexive Questions
Question 1:
It did not have any prior experience with abstract model, but i am glad now i have get a chance to get the experience. As a result,I start with Abstract Model definition and then follow with some detials.
Abstract Model:An abstract model is a theoretical construct that represents physical, biological or social processes, with a set of variables and a set of logical and quantitative relationships between them. Models in this sense are constructed to enable reasoning within an idealized logical framework about these processes and are an important component of scientific theories. Idealized here means that the model may make explicit assumptions that are known to be false in some detail.
Data-centric: Data-centric documents are documents that use XML as a data transport. They are designed for machine consumption and the fact that XML is used at all is usually superfluous. That is, it is not important to the application or the database that the data is, for some length of time, stored in an XML document. Examples of data-centric documents are sales orders, flight schedules, scientific data, and stock quotes.
User-centric:User-centric documents in which you give attention to user needs. For example, if we want to update the version of a software such as Microsoft 2007.Then it was possible Microsoft people had the user survey to find out if it meets the need of the user or not.
Learner-centric:It is used to provide training such as tutors
Information-centric:it is used to present the information to users such as help desk services.
Question 2:
It is important to have the users' information needs drive the design of the model because of many reasons. As Linton mention in her book, we can use an information model as a training tool to provide our content contributors with a guide for creating their information. An information model also provides a way to document best practices within our organization. If you provide a guideline for people to create information, you can ensure that a higher number of people are producing quality information that is more useful to our end users. Also, creating an information model helps ensure standard practice, no matter what changes may come to our organization. Considering the constant practice of acquisitions and mergers currently, we have a better chance of staying consistent and even suggesting a consistent model for any future companies for whom our work.