Download presentation
Presentation is loading. Please wait.
Published bySamson Baker Modified over 9 years ago
1
1 herbert van de sompel CS 502 Computing Methods for Digital Libraries Cornell University – Computer Science Herbert Van de Sompel herbertv@cs.cornell.edu Lecture 11 Markup languages – XML namespaces/schema
2
2 herbert van de sompel XML – basic terminology XML instance document: the document that contains the text in a mark-up-ed form style sheet: the document that contains the formatting instructions to be applied to an instance document Document Type Definition: the document that defines the grammar with which instance documents are compliant (elements, attributes, character set, required elements, optional elements, …) XML Schema: similar as DTD, but more powerful An XML application will usually process 3 types of documents
3
3 herbert van de sompel XML – namespaces Combining elements used in different types of XML documents into one XML instance document Avoid collapse of elements with the same name
4
4 herbert van de sompel My home page My hobby My books 0743204794 Kevin Davies Cracking the Genome 20.00
5
5 herbert van de sompel My home page My hobby My books 0743204794 Kevin Davies Cracking the Genome 20.00
6
6 herbert van de sompel My home page My hobby My books 0743204794 Kevin Davies Cracking the Genome 20.00
7
7 herbert van de sompel boxhtml bo:Book bo:title bo:author bo:price bo:ISBN xhtml:html xhtml:head xhtml:body xhtml:p xhtml:title vocabulary bo vocabulary xhtml XML – namespaces But who guarantees uniqueness of prefixes?
8
8 herbert van de sompel XML – namespaces Give prefixes only local relevance in an instance document Associate local prefix with global namespace name a unique name for a namespace uniqueness is guaranteed by using a URI (preferably URN ) in domain of the party creating the namespace doesn’t have any meaning, i.e. doesn’t have to resolve into anything An XML namespace is a collection of names, identified by a URI reference, which are used in XML documents as element types and attribute names.
9
9 herbert van de sompel <xhtml:html xmlns:xhtml=“http://www.w3c.org/1999/xhtml” xmlns:bo=“http://www.nogood.com/Book”> My home page My hobby My books 0743204794 Kevin Davies ………………
10
10 herbert van de sompel <html xmlns=“http://www.w3c.org/1999/xhtml” xmlns:bo=“http://www.nogood.com/Book”> My home page My hobby My books 0743204794 Kevin Davies ………………
11
11 herbert van de sompel <html xmlns=“http://www.w3c.org/1999/xhtml”> My home page My hobby My books 0743204794 Kevin Davies ………………
12
12 herbert van de sompel <html xmlns=“http://www.w3c.org/1999/xhtml”> My home page My hobby My books 0743204794 Kevin Davies ………………
13
13 herbert van de sompel XML – XML schema Problems with XML DTD’s: DTD’s are not extensible: all rules must be present IN the DTD. Can import declarations from other DTD’s (external entity). Can not inherit those declarations. A document must be valid according to 1 DTD: prevents building on elements from different DTDs Limited support of namespaces: all used elements of all used namespaces must be must be IN the DTD
14
14 herbert van de sompel Problems with XML DTD’s (continued): Poor data typing: DTDs are minly about “text”. No provision for numeric data types, dates, times, strings conforming to regular expressions, URI’s, … DTD’s are defined in non-XML syntax => XML applications need XML processing and Backus Naur processing. Can not use XML tools! XML – XML schema
15
15 herbert van de sompel XML – XML schema by example See http://www.openarchives.org/OAI/openarchivesprotocol.htm
16
16 herbert van de sompel XML Namespaces & Schema XML Namespaces http://www.w3.org/TR/1999/REC-xml-names- 19990114/ http://www.w3.org/TR/1999/REC-xml-names- 19990114/ XML Schema. Part 0: Primer. http://www.w3.org/TR/xmlschema-0/ http://www.w3.org/TR/xmlschema-0/
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.