Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSCI 7818 (Topics in Software Engineering) Web Infrastructure, Services, and Applications Document Type Definition (DTD) Author: Lukasz Kurgan.

Similar presentations


Presentation on theme: "CSCI 7818 (Topics in Software Engineering) Web Infrastructure, Services, and Applications Document Type Definition (DTD) Author: Lukasz Kurgan."— Presentation transcript:

1 CSCI 7818 (Topics in Software Engineering) Web Infrastructure, Services, and Applications Document Type Definition (DTD) Author: Lukasz Kurgan

2 What is DTD? DTD is used to declare each of the building blocks (elements) used in a XML document DTD defines: –a structure of the XML document –a list of legal elements of the XML document DTD by Lukasz Kurgan

3 Well-Formed vs. Valid Document Well-formed document – the document that adheres to the XML syntax rules Valid document – the document that adheres to the rules defined in the corresponding DTD document Only the valid documents are valuable in terms of sharing and retrieving information. DTD by Lukasz Kurgan

4 Internal vs. External DTD DTD by Lukasz Kurgan What is wrong here ?

5 Internal vs. External DTD External DTD are better because of: –possibility of sharing definitions between XML documents –The documents that share the same DTD are more uniform and easier to retrieve Linking in the DTD document Ken Anderson Lukasz Kurgan Ok! We can see some progress DTD by Lukasz Kurgan

6 Building blocks of XML XML documents (and HTML documents) are made up by the following building blocks: DTD by Lukasz Kurgan DescriptionExamples in HTMLExamples in XML Elements main building blocks body,tablenote, from Tags used to markup elements Attributes provide extra information about elements Entities variables used to define common text & " ' PCDATA PCDATA means parsed character data. PCDATA is text that will be parsed by a parser. Tags inside the text will be treated as markup and entities will be expanded. CDATA CDATA means character data. CDATA is text that will NOT be parsed by a parser. Tags inside the text will NOT be treated as markup and entities will not be expanded.

7 Declaring Elements in DTD An element declaration has the following syntax: –Elements name cannot include <> characters and must start with letter or underscore –Elements name can include namespace declaration: Namespace:element-name DTD by Lukasz Kurgan

8 Declaring Elements in DTD Details on element declarations: Empty elements Elements with data Elements with children (sequences) DTD by Lukasz Kurgan

9 Declaring Elements in DTD Details on element declarations: Declaring zero or more occurrences of the same element Declaring minimum one occurrence of the same element Declaring mixed content The example above declares that the element note must contain at least one to child element, exactly one header, zero or more message, and some other parsed character data. DTD by Lukasz Kurgan

10 Declaring Attributes in DTD XML element attributes are declared with an ATTLIST declaration. An attribute declaration has the following syntax: DTD by Lukasz Kurgan valueexplanation attribute-type CDATAcharacter data (eval|eval|..)enumerated value IDunique id NMTOKENvalid XML name default-value #DEFAULT valuedefault value #REQUIREDmust be included in the element #IMPLIEDdoes not have to be included #FIXED valuevalue is fixed

11 Declaring Attributes in DTD Attribute declaration example DTD example: XML example: DTD by Lukasz Kurgan

12 Entities in DTD Variables used to define shortcuts to common text Entity references are references to entities Can be declared internally or externally DTD by Lukasz Kurgan

13 Internal Entities in DTD Define shortcuts to common text Syntax: Example: In DTD: In XML: &copyright; &writer; DTD by Lukasz Kurgan

14 External Entities in DTD Allow to copy the XML content located at specified URI into the current XML document Syntax: Example: In DTD: In XML: Article from www.articles.com &article; DTD by Lukasz Kurgan

15 HTML=XML+DTD+XSL DTD by Lukasz Kurgan XML page DTD page HTML page returned XSL style sheet BROWSER Request for a XML page

16 “Bigger” Example Machine Learning Bibliographies Maintained by Lukasz Kurgan 1. Feature Selection 2. Rule Induction 3. Discretization 4. Learning Ensemble of Classifiers 09/11/01 DTD by Lukasz Kurgan DTD document

17 Why use the DTD? XML provides an application independent way of sharing data With a DTD, independent groups of people can agree to use a common DTD for interchanging data Your application can use a standard DTD to verify that data that you receive from the outside world is valid You can also use a DTD to verify your own data DTD by Lukasz Kurgan

18 Links Demo: http://isl1.cudenver.edu/default.dtd Simple Tutorial: http://www.xml101.com/dtd/dtd_intro.asp Sample XML pages that use DTD and XSL: http://www.w3schools.com/xml/xml_examples.asp http://www.ceth.rutgers.edu/intromat/xml/samples3/samples.htm DTD by Lukasz Kurgan

19 My Impressions XML = extremely syntax sensitive –good thing that assures unification and accessibility of the knowledge on the net Long learning curve –Hard to learn, difficult to display as HTML. People will resist learning it –Thus, the strong need for good XML editors Good Tutorial sites are really needed! But, the XML is the only tool that can result in the next generation of the WWW DTD by Lukasz Kurgan


Download ppt "CSCI 7818 (Topics in Software Engineering) Web Infrastructure, Services, and Applications Document Type Definition (DTD) Author: Lukasz Kurgan."

Similar presentations


Ads by Google