2. April 29th, 2003 Organizing and Searching Information with XML 2
XML is not…
• A replacement for HTML
(but HTML can be generated from XML)
• A presentation format
(but XML can be converted into one)
• A programming language
(but it can be used with almost any language)
• A network transfer protocol
(but XML may be transferred over a network)
• A database
(but XML may be stored into a database)
3. April 29th, 2003 Organizing and Searching Information with XML 3
But then – what is it?
XML is a meta markup language
for text documents / textual data
XML allows to define languages
(„applications“) to represent text
documents / textual data
4. April 29th, 2003 Organizing and Searching Information with XML 4
App. Scenario 1: Content Mgt.
Database with
XML documents
Clients
ConvertersXML2HTML XML2WML XML2PDF
5. April 29th, 2003 Organizing and Searching Information with XML 5
App. Scenario 2: Data Exchange
Legacy
System
(e.g., SAP
R/2)
Legacy
System
(e.g.,
Cobol)
XML
Adapter
XML
Adapter
XML
(BMECat, ebXML, RosettaNet, BizTalk, …)
SuBuyer
Order
6. April 29th, 2003 Organizing and Searching Information with XML 6
App. Scenario 3: XML for Metadata
<rdf:RDF
<rdf:Description rdf:about="http://www-dbs/Sch03.pdf">
<dc:title>A Framework for…</dc:title>
<dc:creator>Ralf Schenkel</dc:creator>
<dc:description>While there are...</dc:description>
<dc:publisher>Saarland University</dc:publisher>
<dc:subject>XML Indexing</dc:subject>
<dc:rights>Copyright ...</dc:rights>
<dc:type>Electronic Document</dc:type>
<dc:format>text/pdf</dc:format>
<dc:language>en</dc:language>
</rdf:Description>
</rdf:RDF>
7. CS561 - Spring 2007. 7
XML
<bibliography>
<book> <title> Foundations… </title>
<author> Abiteboul </author>
<author> Hull </author>
<author> Vianu </author>
<publisher> Addison Wesley </publisher>
<year> 1995 </year>
</book>
…
</bibliography>
XML describes the content
8. CS561 - Spring 2007. 8
XML Terminology
• tags: book, title, author, …
• start tag: <book>, end tag: </book>
• elements: <book>…<book>,<author>…</author>
• elements are nested
• empty element: <red></red> abbrv. <red/>
• an XML document: single root element
well formed XML document: if it has matching tags
9. CS561 - Spring 2007. 9
XML: Attributes
<book price = “55” currency = “USD”>
<title> Foundations of Databases </title>
<author> Abiteboul </author>
…
<year> 1995 </year>
</book>
attributes are alternative ways to represent data
10. CS561 - Spring 2007. 10
XML Namespaces
• http://www.w3.org/TR/REC-xml-names
• name ::= [prefix:]localpart
<book xmlns:isbn=“www.isbn-org.org/def”>
<title> … </title>
<number> 15 </number>
<isbn:number> …. </isbn:number>
</book>
11. CS561 - Spring 2007. 11
<tag xmlns:mystyle = “http://…”>
…
<mystyle:title> … </mystyle:title>
<mystyle:number> …
</tag>
XML Namespaces
• syntactic: <number> , <isbn:number>
• semantic: provide URL for “shared” schema
defined here
12. CS561 - Spring 2007. 12
DTD - Element Type Definitions
<!ELEMENT paper (title,author*, year, (journal|conference) )>
14. XML Tutorial, Bertram
Ludäscher
14
Example: Relational Data to XML
c2b2a2
c3b3a3
c1b1a1
CBA
R R
tuple
A a1 /A
B b1 /B
C c1 /C
/tuple
tuple
A a2 /A
B b2 /B
C c2 /C
/tuple
…
/R
R
tuple
A B C
a1 b1 c1
tuple
A B C
a2 b2 c2
tuple
A B C
a3 b3 c3
15. April 29th, 2003 Organizing and Searching Information with XML 15
XML Example