



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




3
HTML describes the presentation of the content Bibliography
Foundations of Databases Abiteboul, Hull, and Vianu
Addison Wesley, 1995
… XML describes only the content
Foundations of Databases Abiteboul Hull Vianu Addison Wesley 1995
…
) Separation of content from presentation simplifies content extraction and allows the same content to be presented easily in different looks
4
5
Foundations of Databases AbiteboulHull VianuAddison Wesley …1995
6
Wrong: We show that x < 0… Right: We show that x < 0…
Right: ……… Wrong: ………
## More XML featuresHomer… Marge… Bart……
… ……
A DTD is optional
A grammar for the document Constraints on structures and values of elements, attributes, etc.
]>
9
bibliography is the root element of the document
bibliography consists of a sequence of one or more book elements
One or more
Foundations of DatabasesAbiteboul HullVianu Addison Wesley1995 …
book consists of a title, zero or more authors, an optional publisher, and zero or more sections, in sequence
Zero or more
Zero or one
book has a required ISBN attribute which is a unique identifier
book has an optional (#IMPLIED) price attribute which contains character data Other attribute types include IDREF (reference to an ID), IDREFS (space-separated list of references), enumerated list, etc.
10
]>
title, author, publisher, and year all contain parsed character data (#PCDATA)
PCDATA is text that will be parsed (<…> will be treated as a markup tag and < etc. will be treated as entities); CDATA is unparsed character data
Each section starts with a title, followed by some optional text and then zero or more subsections
IntroductionIn this section we introduce XML and DTD… XMLXML stands for… DTD DefinitionDTD stands for… Usage You can use DTD to…
11
… …
… …
… …
12
/bibliography/book/title
/bibliography/book/@ISBN
//title
//section/title
/bibliography/*/author
/bibliography/book[@price<50] XPath will automatically convert the price string to a numeric value for comparison
/bibliography/book[author=‘Abiteboul’]
/bibliography/book[publisher]
/bibliography/book[author=‘Abiteboul’]/@price
21
22
23
24
//*[contains(name(), ‘section’)]
/bibliography/book/section[position()=1]/title A shorthand: /bibliography/book/section[1]/title
/bibliography/book/section[position()=last()]/title
/bibliography/book[count(section)<10]
//[name()!=‘book’]/
Introduction XML is a hot topic these days; see for more details…
/bibliography/book[@ISBN=‘ISBN-10’] //bookref[id(@ISBN)/author=‘Abiteboul’]
27
An axis: one of self, attribute, parent, child, ancestor, ancestor-or-self, descendent, descendent-or-self, following, following-sibling, preceding, preceding- sibling, and namespace A node test: either a name test (e.g., book, section, *) or a type test (e.g., text(), node(), comment()), separated from the axis by :: Zero of more predicates (or conditions) enclosed in square brackets
28
child is the default axis // stands for /descendent-or-self::node()/