Download presentation
Presentation is loading. Please wait.
1
Structured Documents KA1 Document Type definition DTD
2
Structured Documents KA 2 Structural Analysis and DTD 1.Structural Analyses and DTD 2.What is DTD 3.Ex: phonebook.dtd 4.Ex: phonebook.xml 5.Parts of XML Document 6.Producing XML Document 7.XML Browsers 8.Ex phonebook.xsl 9.DTD Planning 10.XML: Separators 11.XML: Comments and Naming 12.XML: Elelemnts 13.XML: Order of elements 14.Ex: Letter 15.Ex: Letter b 16.Ex: letter c 17.DTD: Building Blocks 18.DTD: Elements 19.XML tags 20.DTD: Attributes 21.Types of Attribute 22.Attribute Defaults 23.DTD: Predefined Entities 24.DTD: Own Entities 25.DTD: PCDATA / CDATA
3
Structured Documents KA 3 What is a DTD DTD = Document Type Definition definition of the document class DTD descripes the logical elements, their order and content DTD can be created from the structure diagram
4
Structured Documents KA 4 Example phonebook.dtd
5
Structured Documents KA 5 Example phonebook. xml Michael Schumacher Nelikkoratsu 2 A56 01234 Heinola 04 11223 344 ……
6
Structured Documents KA 6 Parts of an XML Document A XML document itself consist of: XML declaration (can be missing) Document Type Definition (DTD can be missing) Root element (eg. Document instance (representative of the document class) XML declaration informs the XML prosessing system about the version and the character set e.g. DTD can be written directly into a document itself or into another document
7
Structured Documents KA 7 Producing an XML Document XML + DTD XML editor dbase simple editor Paper doc IntelligentOCR Structured doc conversion XML Spy XMetal Eclipse
8
Structured Documents KA 8 Example phonebook.xsl Phonebook Company …..
9
Structured Documents KA 9 DTD Planning 1. Define application area (firm, department …) 2. Define strategy of using the DTD 1. Why to do the DTD? 2. How DTD is applied? 3. Priority of functionality? 4. Access criterias? 5. Sorting/Calculation criterias 3. Define the users 4. Name the DTD 5. Define the logical elements of the document class 1. Structure analyzes 2. Name the elements 3. Element vs. attribute
10
Structured Documents KA 10 XML: Separatos /> Used to separate the information and the markup E.g. Header
11
Structured Documents KA 11 XML: Comments and Naming A comment is defined XML name consist of the following chars: 1. char a-z, A-Z 2-n. chara-z, A-Z, 0-9,.,- NO tab or whitespace XML names are CASE sensitive
12
Structured Documents KA 12 XML: Elements Element format Element ending Element is defined in the DTD Element can include other elements The part within the parenthis is called the model group. Element can be text, #PCDATA or include other elements.
13
Structured Documents KA 13 XML: Order of Elements Elements in sequence are separated with a comma (,) 0,1 or n times appearing elements with (*) 1 or n times appearing elements with (+) Alternative elements with a pipe (|) 0 or 1 time appearing element with a question mark (?)
14
Structured Documents KA 14 Example: letter letter.dtd letter.xml Seija R. Kake A. Perjantaina on tiimipalaveri Seija R.
15
Structured Documents KA 15 Example: letter b letterb.dtd letterb.xml Seija R. Kake A. Tiimipalaveri Perjantaina on tiimipalaveri Seija R. Erkki R.
16
Structured Documents KA 16 Example: letter c letterc.dtd
17
Structured Documents KA 17 DTD Building Blocks Seen from a DTD point of view, all XML documents (and HTML documents) are made up by the following simple building blocks: Elements Tags Attributes Entities PCDATA = parseable character data CDATA
18
Structured Documents KA 18 DTD: Elements Elements are the main building blocks of both XML and XHTML documents. Examples of XHTML elements are "body" and "table". Examples of XML elements could be "note" and "message". Elements can contain text, other elements, or be empty. Examples of empty HTML elements are "hr", "br" and "img".
19
Structured Documents KA 19 XML: Tags Tags are used to markup elements. A starting tag like marks up the beginning of an element, and an ending tag like marks up the end of an element. body element marked up with body tags: body text in between. message element marked up with message tags: some message in between
20
Structured Documents KA 20 DTD: Attributes Attributes provide extra information about elements. Attributes are always placed inside the starting tag of an element. Attributes always come in name/value pairs. The following "img" element has additional information about a source file: The name of the element is "img". The name of the attribute is "src". The value of the attribute is "computer.gif". Since the element itself is empty it is closed by a " /". DTD:.xml:
21
Structured Documents KA 21 Types of Attribute TypeMeaning CDATACharacter data (string) ID IDREF IDREFS Name unique within a given document Reference to some element bearing an ID attribute Series of IDREFs delimited with white space ENTITY ENTITIES Name of predefined external entity Series of entity names delimited by white space NMTOKENA name NOTATIONAccepts one of a series of explicitly user-defined values that the attribute can take on dtd: xml: dtd: xml: …
22
Structured Documents KA 22 Attribute Defaults ValueExplanation valueThe attributes default value #DEFAULT valueThe attributes default value #REQUIREDThe attribute value must be included in the element #IMPLIEDThe attribute does not have to be included #FIXED valueThe attribute value is fixed
23
Structured Documents KA 23 DTD: Predefined Entities Entities are variables used to define common text. Entity references are references to entities. Most of you will know the HTML entity reference: " ". This "no- breaking-space" entity is used in HTML to insert an extra space in a document. Entities are expanded when a document is parsed by an XML parser. The following entities are predefined in XML: Entity References Character << >> && "" ''
24
Structured Documents KA 24 DTD: Own Entities Every where in XML file the note &EVTEK; is replaced with string Espoo Vantaa Instituite of Technology and It is 45 ° now in Turkey is replaced with string It is 45° now in Turkey
25
Structured Documents KA 25 DTD: PCDATA / CDATA 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 also 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.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.