HTML VS XML Structural Information e hTML documents do not contain structural information: pieces of the document and their relationships o XML more easily accessible to machines because Every piece of information is described Relations are also defined through the nesting structure E.g., the <author> tags appear within the <book> tags, so they describe properties of the particular book 6 Chapter 2 A Semantic Web primer
Chapter 2 A Semantic Web Primer 6 HTML vs XML: Structural Information ⚫ HTML documents do not contain structural information: pieces of the document and their relationships. ⚫ XML more easily accessible to machines because – Every piece of information is described. – Relations are also defined through the nesting structure. – E.g., the <author> tags appear within the <book> tags, so they describe properties of the particular book
HTML VS XML: Structural Information(2) e A machine processing the XML document would be able to deduce that the author element refers to the enclosing book element rather than by proximity considerations ●Ⅹ ML allows the definition of constraints on values E.g. a year must be a number of four digits 7 Chapter 2 A Semantic Web primer
Chapter 2 A Semantic Web Primer 7 HTML vs XML: Structural Information (2) ⚫ A machine processing the XML document would be able to deduce that – the author element refers to the enclosing book element – rather than by proximity considerations ⚫ XML allows the definition of constraints on values – E.g. a year must be a number of four digits
HTML VS XML: Formatting o The HTML representation provides more than the XML representation The formatting of the document is also described o The main use of an html document is to display information: it must define formatting XML: separation of content from display same information can be displayed in different Ways 8 Chapter 2 A Semantic Web primer
Chapter 2 A Semantic Web Primer 8 HTML vs XML: Formatting ⚫ The HTML representation provides more than the XML representation: – The formatting of the document is also described ⚫ Τhe main use of an HTML document is to display information: it must define formatting ⚫ XML: separation of content from display – same information can be displayed in different ways
HTML VS XML: Another Example ● In HTMl <h2>Relationship matter-energy </h2> <i>E=M×c2<> ●nxML <equation> <meaning Relationship matter energy</meaning> <leftside> E </leftside> <rightside> M x C2 </rightside> </equation> 9 Chapter 2 A Semantic Web primer
Chapter 2 A Semantic Web Primer 9 HTML vs XML: Another Example ⚫ In HTML <h2>Relationship matter-energy</h2> <i> E = M ×c2 </i> ⚫ In XML <equation> <meaning>Relationship matter energy</meaning> <leftside> E </leftside> <rightside> M ×c2 </rightside> </equation>
HTML VS XML: Different Use of Tags e In both hTml docs same tags In XML completely different HTML tags define display: color, lists XML tags not fixed: user definable tags XML meta markup language: language for defining markup languages 10 Chapter 2 A Semantic Web primer
Chapter 2 A Semantic Web Primer 10 HTML vs XML: Different Use of Tags ⚫ In both HTML docs same tags ⚫ In XML completely different ⚫ HTML tags define display: color, lists … ⚫ XML tags not fixed: user definable tags ⚫ XML meta markup language: language for defining markup languages