1 The XML Alphabet Soup name Sharat Chandran

1 The XML Alphabet Soup <name> Sharat Chandran </name> <url> http: //www. cse. iitb. ernet. in/~sharat</url> Copyright Ó IIT Bombay, 2000. All rights reserved.

What Does XML Look Like? <? xml version="1. 0"? > <rowset> <row num="1"> <employeenumber>7369</employeenumber> <name>SMITH</name> <salary>800</salary> </row> <row num="2"> <employeenumber>7499</employeenumber> <name>ALLEN</name> <salary>1650</salary> </rowset> • • 1 -3 Markup reflects the structure of the information Markup is specific to a particular application domain Copyright Ó IIT Bombay, 2000. All rights reserved.

Why The XML Hype? • • 1 -4 The World Wide Web (WWW) – Information is supposed to travel with the speed of light – There is supposed to be lots of data on the Internet – Most of the web traffic is HTML traffic The World Wide Wait paradox – You don't get the information quickly enough – You don't get what you want Copyright Ó IIT Bombay, 2000. All rights reserved.

Why Bother With XML? • • 1 -5 You can use XML to organize your semistructured data in a consistent way. – The XML hierarchical process helps you organize your contents. – The XML standard enables you to publish your data to various “end” uses such as databases, HTML, and B 2 B. XML appears to be the ASCII of the future. – XML contains metadata about Internet pages. – XML can be interpreted by standard browsers. Copyright Ó IIT Bombay, 2000. All rights reserved.

Why Bother With XML? • • 1 -6 Your time investment is protected. – XML tags enable you to evolve your pages with backwards compatibility. – XML documents are well structured. – XML is easy to learn. – XML is well integrated with various tools. XML is powerful. – XML provides a compact, succinct subset of SGML. – XML enables easy design of domain-specific languages. Copyright Ó IIT Bombay, 2000. All rights reserved.

What Is XML? • A markup language annotates (or marks up) some text. • XML is a markup meta-language. – – It enables you to define your own language. – You can use it to extend your language should you feel the need. It establishes rules about how you can mark up a document. Note: HTML is a markup language that does not (may not) obey the rules of XML. • 1 -7 Practical Definition: XML consists of a set of standards to exchange and publish information in a structured manner. Copyright Ó IIT Bombay, 2000. All rights reserved.

XML Page Contents • You can use XML to create your own tags. – Tags may be stylistic tags, structural tags, or semantic tags. – Resulting XML documents may seem arbitrary. • An element consists of tags, and some content between the start and end tags. • Constraining XML: – – 1 -8 XML documents must obey syntax rules. XML documents may also have associated structural constraints. Copyright Ó IIT Bombay, 2000. All rights reserved.

Agenda • • • 1 -9 XML: The Basics DTD and Schemas Styling Parsing Application Copyright Ó IIT Bombay, 2000. All rights reserved.

Some Syntactic Rules XML documents: • • Begin with an XML declaration Contain empty and nonempty tags – Empty tags end with /> – Nonempty tags – Usually contain more information than empty tags – Must match and nest properly – Include a unique opening and closing tag that contains the whole document (the ROOT element) • 1 -10 Contain attributes (values must be in quotes) Copyright Ó IIT Bombay, 2000. All rights reserved.

Document Type Definition • • 1 -11 Syntactic rules do not constrain possibilities. Domain specific constraints can be applied by Document Type Definition (DTD). – – Identifies the elements and attributes – Formally describes the syntax Describes how they can be nested and whether they must be present The DTD has a defined syntax that enables the DTD itself to be parsed. The DTD is identified by the dtd extension in XML documents. Copyright Ó IIT Bombay, 2000. All rights reserved.

XML Structure Revisited • Prologue: – – – • • XML declaration DTD Processing Instructions and Comments Root Element <? xml version="1. 0" encoding='WINDOWS-1252'? > <!DOCTYPE Jbo. Project SYSTEM "jbo_02_01. dtd"> <Jbo. Project Epilogue: Processing Instructions and Comments 1 -12 </Jbo. Project> <? gif. Player size=“ 100, 300” ? > Copyright Ó IIT Bombay, 2000. All rights reserved.

Common Syntax Errors • End tags are omitted or incorrect: <tel> is completed by </TEL>. • Space is used in the element name: <Lawn Tennis> • Quotes are incorrectly used: <invitation preferred=‘true> Won’t you use chopsticks? </invitation>. 1 -13 Copyright Ó IIT Bombay, 2000. All rights reserved.

More On DTD • DTD may appear externally as a file with a. dtd extension. • DTD may also be specified internally as a document type declaration following the XML declaration. – foo refers to the document – foo contains parsed character data (#PCDATA) <? xml version="1. 0" standalone="yes"? > <!DOCTYPE foo [ <!ELEMENT foo (#PCDATA)> ]> <foo> Hello XML! </foo> 1 -14 Copyright Ó IIT Bombay, 2000. All rights reserved.

Problems With DTD • DTD is written with yet another syntax. XSD schemas are well-formed XML documents. • • DTD offers limited data types. • XML Schema overcomes the above limitations and offers a richer, expressive constraint specifying mechanism. XML Schema files are stored with the. xsd extension. • 1 -15 DTD has a complex and fragile extension mechanism. Copyright Ó IIT Bombay, 2000. All rights reserved.

XSD: Example <element. Type name="address"> <sequence> <element. Type. Ref name="name" min. Occur="1" max. Occur="1"/> <element. Type. Ref name="street" min. Occur="1" max. Occur="2"/> <element. Type. Ref name="city" min. Occur="1" max. Occur="1"/> <element. Type. Ref name="state" min. Occur="1" max. Occur="1"/> <element. Type. Ref name="zip" min. Occur="1" max. Occur="1"/> <element. Type. Ref name="country" min. Occur="0" max. Occur="1"/> </sequence> </element. Type> <!ELEMENT address (company? , name, street+, city, state, zip)> 1 -16 Copyright Ó IIT Bombay, 2000. All rights reserved.

Some XSD Features • • • You can create your own data types. • • Uniqueness can be expressed. • Equivalence of elements is allowed. 1 -17 You can derive a new type based on an earlier type. Many data types (Boolean, numbers, dates and times, URI, integers, decimal numbers, real numbers, intervals of time, sets). Multiple elements with the same name but different content are allowed. Copyright Ó IIT Bombay, 2000. All rights reserved.

Resources • • XML Schemas are relatively new. http: //www. w 3. org/XML/Schema: Official W 3 site • Schema Validator: – http: //www. w 3. org/2000/06/webdata/xsv: Free Web-form access (University of Edinburgh/W 3 C) – http: //technet. oracle. com/tech/xml/schema _java/index. htm: Free validator from Oracle • http: //www. w 3. org/2000/04/schema_hack: A conversion tool from DTD to XML Schema in Perl (open source) 1 -18 Copyright Ó IIT Bombay, 2000. All rights reserved.

Namespace • • XML enables you to define tags. • As your document XML moves around the Internet, there is a strong possibility that your tag names may be chosen for use by someone else. • Namespaces distinguish elements with the same name from those of different XML applications. 1 -19 In stand-alone documents, there is no possibility of identical tag names representing different meanings. Copyright Ó IIT Bombay, 2000. All rights reserved.

Namespaces: Example <? xml version="1. 0" ? > <myelement xmlns: oracle=“http: //www. oracle. com/tagnames” xmlns: xbm=“http: //www. xbm. com/tagnames”> <oracle: database quality=“fantastic” /> <xbm: database quality=“itdepends” /> </myelement> • The database tag is intended specifically to represent a relational DBMS. • However, there are two types of databases identified by the prefix oracle and xbm. • oracle: database is a short form for http: //www. oracle. com/tagnames/database. 1 -20 Copyright Ó IIT Bombay, 2000. All rights reserved.

More About Namespaces • A namespace is defined using the special attribute name starting with xmlns: . • The string to the right of the xmlns: (such as oracle in xmlns: oracle) is the short form name for any tags to be used. • • The value of the attribute is typically a URL. If the string after xmlns is null, then any tag used without a colon refers to the default namespace. <? xml version="1. 0" ? > <html xmlns=“http: //www. w 3. org/TR/REC-html 40” <table> … </table> </html> 1 -21 Copyright Ó IIT Bombay, 2000. All rights reserved.

Agenda • • • 1 -22 XML: The Basics DTD and Schemas Styling Parsing Application Copyright Ó IIT Bombay, 2000. All rights reserved.

Style • Recall that elements have structural, semantic, and style connotations. • Style describes how a tag is displayed in various environments. • Two common ways of display are achieved using: • – Cascaded Style Sheets (CSS) – Extended Style Language (XSL) By separating style from content, different interfaces can be presented to different user types. Styling can be done either at the client side, or at the server side. • 1 -23 Copyright Ó IIT Bombay, 2000. All rights reserved.

CSS • Instead of describing the style in every document you write, a stylesheet can be attached to a document. • The same stylesheet can be attached to several documents (for example, documents in your Intranet corporate site). • Stylesheets can be piled one on top of another, each describing different stylistic aspects. 1 -24 Copyright Ó IIT Bombay, 2000. All rights reserved.

Simple Example With CSS <? xml version="1. 0" ? > <? xml-stylesheet type="text/css" href="baz. css" ? > <foo> <bar> This text is within bar. </bar> <baz> This text is within baz. </baz> </foo> baz {display: block; fontsize: 24 pt; font-weight: bold; } bar {display: block; fontsize: 12 pt; font-weight: bold; } 1 -25 Copyright Ó IIT Bombay, 2000. All rights reserved.

Why “Cascade”? Browser Default Navigator, IE Internals External Stylesheet <LINK Internal Stylesheet <STYLE> … </STYLE> Style Tags <B>, <FONT>, . . . Inline Style <DIV STYLE=“font: bold; ”>…</DIV> TYPE="text/css”. . . > Resultant Element Style 1 -26 Copyright Ó IIT Bombay, 2000. All rights reserved.

CSS Summary • • • Selectors: Element, context, ID Display Property: Block, inline, list Other Properties – Box (border, margin, padding) – Color, font, text person { display: block; font-family: arial; } name { display: block; font-size: 10 pt; font-weight: bold; margin: 4, 0, 4, 30; font-style: italic; } street, city. State. Zip, phone, email. Name { display: block; font-size: 10 pt; font-weight: normal; margin: 4, 0, 4, 30; } employer name { display: block; font-size: 10 pt; font-weight: bold; margin: 4, 0, 4, 30; color: red; } 1 -27 Copyright Ó IIT Bombay, 2000. All rights reserved.

CSS 1/CSS 2 Standards • W 3 C Recommendations (12/96 and 5/98, respectively) • CSS 2: – – – 1 -28 Position properties Visual effects Generated content Page properties Table properties Aural properties Copyright Ó IIT Bombay, 2000. All rights reserved.

Advantages of CSS • • • 1 -29 Widely known and implemented Comparatively simple and direct Firm W 3 C standards Copyright Ó IIT Bombay, 2000. All rights reserved.

Problems With CSS • • • Limits on formatting/layout Only suited for use within the browser Separation of content and style – No content reordering – No access to attributes 1 -30 Copyright Ó IIT Bombay, 2000. All rights reserved.

Motivation Behind XSL • • • Separate presentation and content Add content such as logo or footer page Create new content such as a table of contents Present information at the proper level of detail Convert between different DTD Transform XML into HTML XML Document XSL Stylesheet 1 -31 E-Com Messaging Java VM XML Parser XSLT Copyright Ó IIT Bombay, 2000. All rights reserved. HTML, XML HTTP Server

XSL • Element attributes are not rendered when you use CSS. • XSL • • 1 -32 – Is a language that obeys XML syntax – Enables you to render attributes – Enables you to transform your element contents in any way you like You program the transformation using the XSL language. With XSL you can – Transform XML into XML (that conforms with another DTD) or other text-based formats – Rearrange or filter data Copyright Ó IIT Bombay, 2000. All rights reserved.

XSL Basics • Two languages • • • – A transformation language with some similarity to languages such as AWK – A formatting language similar to CSS XSLT, meaning XSL transformation XSLFO, meaning XSL Formatting Objects XSL can be used at the client end or server end 1 -33 Copyright Ó IIT Bombay, 2000. All rights reserved.

A Simple XSL file • • • XSL is written using XML (it also could have been written in Awk). XSL elements are prefaced with xsl: The<html>… </html>tag pair is output. <? xml version="1. 0"? > <xsl: stylesheet xmlns: xsl="http: //w 3. org/TR/WD-xsl"> <xsl: template match="/"> <html> <!-- XSL commands come in here --> </html> </xsl: template> </xsl: stylesheet> 1 -34 Copyright Ó IIT Bombay, 2000. All rights reserved.

XSL in Action <? xml version="1. 0" ? > <? xml-stylesheet type="text/xsl" href=”state. xsl"? > <DOCUMENT> <STATE> <NAME>Louisiana</NAME> <TREE>Bald Cypress</TREE> </STATE> <NAME>Texas </NAME> <CAPITAL>Austin</CAPITAL> </STATE> </DOCUMENT> 1 -35 Copyright Ó IIT Bombay, 2000. All rights reserved.

Overview: How the XSL Transformation Works • XSL converts a tree representation of an XML document into another XML document. • The conversion is triggered according to your needs. Root DOCUMENT NAME 1 -36 Copyright Ó IIT Bombay, 2000. All rights reserved. STATE

Elements in the XSL Script <? xml version="1. 0" ? > <? xml-stylesheet type="text/xsl" href=”state. xsl"? > • • • 1 -37 The XSL translator loads the XSL script due to the xml-stylesheet directive and its attributes. The stylesheet element in the XSL script constitutes the root element. The script consists of various template directives. Copyright Ó IIT Bombay, 2000. All rights reserved.

Elements in the XSL Script <? xml-stylesheet type="text/xsl" href=”state. xsl"? > <DOCUMENT> … </DOCUMENT> • The root node in the XML tree is an abstract entity above the root element. • The first template matches the root node. This is because of the match=/ attribute. • Upon the match, the token <html>is first output. 1 -38 Copyright Ó IIT Bombay, 2000. All rights reserved.

Elements in the XSL Script <? xml-stylesheet type="text/xsl" href=”state. xsl"? > <DOCUMENT> … </DOCUMENT> • • • 1 -39 The apply-template element causes the translator to apply the matching algorithm recursively to each of the root’s children. In the example, the root has one child consisting of the root element. When the script is applied recursively, the first template match=/ fails. Copyright Ó IIT Bombay, 2000. All rights reserved.

Elements in the XSL Script <DOCUMENT> <STATE> <NAME>Louisiana</NAME> <TREE>Bald Cypress</TREE> </STATE> </DOCUMENT> • When the script is applied recursively, the second template match=“DOCUMENT” succeeds. • The action consists of applying the template recursively on the children of the ROOT element. 1 -40 Copyright Ó IIT Bombay, 2000. All rights reserved.

Elements in the XSL Script <DOCUMENT> <STATE> <NAME>Louisiana</NAME> <TREE>Bald Cypress</TREE> </STATE> </DOCUMENT> • When the script is applied recursively on the children of the root element, the first and second template fail. • The third template, match=“STATE” succeeds. 1 -41 Copyright Ó IIT Bombay, 2000. All rights reserved.

Elements in the XSL Script <DOCUMENT> <STATE> <NAME>Louisiana</NAME> <TREE>Bald Cypress</TREE> </STATE> </DOCUMENT> • Now the P tag is sent as output. • The next action is to apply the value-of element. • The attribute-select causes the value Louisiana to be output. 1 -42 Copyright Ó IIT Bombay, 2000. All rights reserved.

Elements in the XSL Script <DOCUMENT> <STATE> <NAME>Louisiana</NAME> <TREE>Bald Cypress</TREE> </STATE> </DOCUMENT> • Next, Bald Cypress is emitted. • At this point, processing of the first the two children is finished. • The script then recursively outputs the results shown. 1 -43 Copyright Ó IIT Bombay, 2000. All rights reserved.

XSL Tree Nodes • There are several types of XML nodes: • – The root – Elements, including the root element – Text – Attributes – Namespaces – Processing instructions – Comments Each node is said to have a value. 1 -44 Copyright Ó IIT Bombay, 2000. All rights reserved.

Content of the XSL Formatting Language • • 1 -45 The formatting language consists of about 50 different elements such as tables, horizontal rules, and graphics. The elements start with the fo: prefix. Elements have formatting properties such as background-color and borders. The formatting language can be digested by a program that renders output such as PDF or HTML. Copyright Ó IIT Bombay, 2000. All rights reserved.

Agenda • • • 1 -46 XML: The Basics DTD and Schemas Styling Parsing Application Copyright Ó IIT Bombay, 2000. All rights reserved.

XML Parser • • Is also known as XML processor • Looks up the DTD definition when specified and available • May be a used as a stand-alone program or programmatically Reads an XML document and verifies that the XML it contains is well formed – DOM (Document Object Model) – SAX (Simple API for XML) 1 -47 Copyright Ó IIT Bombay, 2000. All rights reserved.

XML Parser <? xml version="1. 0" ? > <DOCUMENT> <STATE> <NAME>Louisiana</NAME> <TREE>Bald Cypress</TREE> <FLOWER>Magnolia</FLOWER> <CAPITOL>Baton Rouge</CAPITOL> </STATE> <NAME>Mississippi</NAME> <TREE>Magnolia</TREE> <CAPITOL>Jackson</CAPITOL> </STATE> </DOCUMENT> 1 -48 Copyright Ó IIT Bombay, 2000. All rights reserved.

XML Parsing: Review • • 1 -49 An XML parser checks whether your XML document is: – Well-formed – Valid (optional) Remember that namespaces can be involved in verifying that your document is well-formed. – <xsl: query … > – <somethingelse: query> The Oracle XML parser also enables you to make an XSL transformation. The parser is an utility for a Java (or C or PL/SQL) programmer. Copyright Ó IIT Bombay, 2000. All rights reserved.

DOM • An explicit representation of the XML document is created. • • An API is available for XML programmers. • DOM is specified in IDL, and thus the API is available in languages other than Java. • DOM is used in applications such as browsers and XML editors. 1 -50 The API enables you to visit elements, contents of elements, siblings, parents, and so on. Copyright Ó IIT Bombay, 2000. All rights reserved.

SAX • An explicit representation of the object hierarchy is not created. • Instead “events” are generated corresponding to “interesting” lines in your XML files. • • 1 -51 – Appearance of an angle bracket – Appearance of attributes Compared to object-based interfaces such as DOM, the SAX API is parsimonious and operates at a lower level. Your application may internally use a different data structure, and thus you do not need the object hierarchy. Copyright Ó IIT Bombay, 2000. All rights reserved.

Standard Parser APIs XML Parser • • 1 -52 Portable applications Portable developer skills W 3 C Standard APIs SAXParser DOMParser – Document Object Model (DOM) Level 1 – Simple API for XML 1. 0 (SAX) All “major” XML parsers are DOM/SAX compliant Copyright Ó IIT Bombay, 2000. All rights reserved.

The DOM Parser • • DOMParser creates the tree <!DOCTYPE person SYSTEM "person. dtd" > <person> Document object includes objects of type: – XMLElement – XMLAttr – XMLNode XMLDocument </person> Root !DOCTYPE <name> Jane Smith </name> <phone id="main" > 408 -555 -1212 </phone> <person> DTD <name> <phone> XMLAttr XMLElement Jane Smith 408 -555 -. . . XMLText 1 -53 @id “main” Copyright Ó IIT Bombay, 2000. All rights reserved.

What Does the Parser Do? • • • 1 -54 Constructs document object from text Provides methods to inspect and modify Complies with W 3 C XML recommendation Copyright Ó IIT Bombay, 2000. All rights reserved.

XML Parser: Example 1 -55 Copyright Ó IIT Bombay, 2000. All rights reserved.

Overall Loop double rate = Double. value. Of(…). double. Value(); XMLDocument document = parse(somefilename); Element top. Level = document. get. Document. Element(); walk. Node(top. Level, rate); • Obtains rate as a Java double • Obtains the XML Document • • Obtains the root element 1 -56 Classes XMLDocument DTD XMLElement XMLAttr XMLText Processes the root element Copyright Ó IIT Bombay, 2000. All rights reserved. DOM Interface Document. Type Element Attr Text

Obtaining the XML Document protected static XMLDocument parse(String somefilename) throws Exception { // Get an instance of the parser DOMParser parser = new DOMParser(); // Generate a URL from the filename. URL url = create. URL(somefilename); parser. parse(url); return parser. get. Document(); } • • 1 -57 Although the DOM model is used, the precise means of obtaining the XML document differs based on implementation. In this example, we need to create a DOMParser object. Copyright Ó IIT Bombay, 2000. All rights reserved.

Obtaining the Root Element double rate = Double. value. Of(…). double. Value(); XMLDocument document = parse(somefilename); Element top. Level = document. get. Document. Element(); • • • 1 -58 Recall the differences between the – Root node of an XML tree – Root element Element is defined in the org. w 3 c. dom package. XMLDocument is defined in the oracle. xml. parser. v 2 package. Copyright Ó IIT Bombay, 2000. All rights reserved.

The Main Recursive Loop protected static void walk. Node(Node node, double rate){ if(node. get. Node. Type() == Node. ELEMENT_NODE){ if(node. get. Node. Name(). equals("product")) walk. Product((Element)node, rate); else { Node. List children = node. get. Child. Nodes(); for(int i = 0; i < children. get. Length(); i++) walk. Node(children. item(i), rate); } // end else } // end out if } // end method • • 1 -59 Recall the various types of nodes in an XML tree. Check whether a node is the type that interests you. Copyright Ó IIT Bombay, 2000. All rights reserved.

The Business Logic: Actual Computation void walk. Product(Element element, double rate){ String name = null; double price = 0. 0; Node. List children = element. get. Child. Nodes(); for(int i = 0; i < children. get. Length(); i++) { Node child = children. item(i); if(child. get. Node. Name(). equals("price")){ String st = get. Text(child); price = Double. value. Of(st). double. Value(); price *= rate; } else if(child. get. Node. Name(). equals("name")) name = get. Text(child); } System. out. println(name + ": " + price); } 1 -60 Copyright Ó IIT Bombay, 2000. All rights reserved.

DOM and SAX • • • 1 -61 Both are parsers DOM – Resembles the object model – Generally useful in XML tools SAX – Lower level – Generally more efficient – Useful when you do not want to maintain an object model data structure but have your own Copyright Ó IIT Bombay, 2000. All rights reserved.

Agenda • • • 1 -62 XML: The Basics DTD and Schemas Styling Parsing Application Copyright Ó IIT Bombay, 2000. All rights reserved.

About XML Applications • • Remember that XML is a metalanguage. • Do not confuse XML applications with programs that can digest XML (Internet Explorer, XML Spy). • Sample XML applications: Concrete languages that adhere to XML specifications are called XML applications. – Math. ML (for mathematics on the Web) – VML and other Scalable Vector Graphics languages (generic graphics for the Web) – WML (for wireless technologies) – Vox. ML (for voice) 1 -63 Copyright Ó IIT Bombay, 2000. All rights reserved.

Overview of XSQL • • XSQL is an XML application. • • XSQL pages are designed to work with a database. Documents written in XSQL are referred to as XSQL pages are designed – To work from a browser – To work from your Java program • 1 -64 XSQL pages produce dynamic data based on your SQL query. Copyright Ó IIT Bombay, 2000. All rights reserved.

Benefits of XSQL • • • 1 -65 Web publishing of database information becomes easy – To a person who does not know any Java Servlet or JSP programming. – To a person who knows SQL. Transfer of XML data for business-to-business becomes easy using only a browser. Declaratively specifying the data contents separately from presentation – Makes maintenance simple. – Enables higher productivity. Copyright Ó IIT Bombay, 2000. All rights reserved.

A Simple XSQL Page XSQL source XSQL request from a browser and resulting output 1 -66 Copyright Ó IIT Bombay, 2000. All rights reserved.

A Simple XSQL Page • • The source obeys XML syntax. • Attributes specify A single SQL statement is the textual content of the root element. – Which database to go against – Namespace used 1 -67 Copyright Ó IIT Bombay, 2000. All rights reserved.

XLink • • Links are a standard feature on the Web. XLink is a mechanism that adds linking capabilities to XML documents. – Any element can serve as a source for linking (in HTML, the anchor element serves to link). – Multiple pages can be linked to and from an element. – Links do not have to be part of an XML document. – Along with XPointer, a link can be established to any part of a document. 1 -68 Copyright Ó IIT Bombay, 2000. All rights reserved.

Simple XLink Example <? xml version="1. 0" ? > <bibliography> xmlns: my="http: //example. edu/" bibliography: last. Edited="2000 -06 -10" xmlns: xlink="http: //www. w 3. org/1999/xlink" xlink: type="simple" xlink: href=”graphics. xml"> Graphics Gems </bibliography> • • • The bibliography element is capable of linking to a simple resource, as defined by the href attribute. This link is a simple link, as described in its type attribute (simple links link only to one document). The element, and thus the link, has other attributes (metadata such as last. Edited). 1 -69 Copyright Ó IIT Bombay, 2000. All rights reserved.

More Complex XLink Example <? xml version="1. 0" ? > <bib> xlink: show=“replace” xlink: actuate=“user” xlink: type=”extended”> <xlink: locator href=“http: graphicsgems. com” /> <xlink: locator href=“http: foo. edu/graphics” /> </bib> • The bib element is capable of linking to multiple resources. • Browsers may offer a pop-up window to select one of multiple resources. • This example also shows other attributes of XLink elements such as show and actuate. • Links may be be stored in an external document. 1 -70 Copyright Ó IIT Bombay, 2000. All rights reserved.
- Slides: 69