Untitled Document



 Introduction to XML
 Data Definition and Data  Modeling
 Namespaces and  Schemas
 Linking and Querying
 Hyperlinks and its need
 
   Hyperlinks
   Links
   Linking and Querying
   XML information set
   Link elements
   Locators
   Xlinks
   Simple Links
   Extended links
   Extended link groups
 Inline and out-of-line  links
   Inline extended link
 Inline and out-of-line  links
 Out-of-line extended  links - link databases
   Link databases
   Link behavior
   Link effects
 Problem with HTML  pointers
   Xpointers
   Xpointer specification
 Specifying Xpointers  in a URI
   Elements Structure
   Location terms
   Relative terms
 Selection
 Querying using query  language
 
 Querying using  Query language
 Querying XML using  XPath and XSLT
   XSL & XSLT
 Row-wise restriction  of returned  information
 Column-wise  restriction
 Sorting
 Ecommerce Application  using XML

Copyrights : Layout Galaxy All Rights Reserved
No part of this tutorial may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, electrostatic, magnetic tape, mechanical or otherwise, without prior permission in writing from Layout Galaxy.




 Linking and Querying > Hyperlinks and its need

  Hyperlinks

Hyper text differs from the normal text in that they have hyperlinks. The hyperlinks are identified by the characteristic blue color underlined text that identifies hot spots. These hotspots when clicked, will take us to the Web pages that are specified as links.

Linking or cross-referencing can be done when :

There is a need to provide context-sensitive help, for instance, when we navigate tutorials, it will be easy to understand if elaborations for some technical terms or external references are provided.
A file has to be referred or displayed on clicking the mouse at a particular point of the document.

  Links

Link is a functionality that is associated with a text or an object in a document using markup language.

Providing links enable us to refer to an object or a file within the same document or a document in some other location. The object which is referred to, can be an image file or any other file, or text within the same document, or a different document. Within a HTML or an XML document, there may be several links. The active document, which contains these links, is called the source file.

The linked file or file that has been referred to is called the destination file or the target.

The target file may be directly opened on clicking a hotspot or it may in turn lead to some other link. In simple terms of HTML linking, a link is the association between a source and the target.
The target may be completely a new HTML page, in which case, the description of the target (locator) would be a Universal Resource Identifier (URI). The target may be a named element within an HTML page. It can be identified using the # symbol, called a fragment identifier. Then, the fragment identifier has to be followed by the NAME attribute of the target element.

Both the source and the target file can be viewed simultaneously. One of the best examples of viewing both the source and the target simultaneously, is the search index provided in the HELP menu of any application, wherein selecting a particular index opens the corresponding document.

The differences between HTML links and XML links are depicted in the table shown here.

HTML Links
XML Links
The linking mechanism is simple. The linking mechanism is complex.
HTML links talks about sources and target. XML's Xlink talks about linking elements instead of sources.
Links are unidirectional, that is, one link lead the other end of a link in a straight. Links can be bidirectional, so the other end of link could be a source as well as target.
The source link leads to the target link. Source link could refer to resource, which could be a piece of data, obtained as a result of a database query or an external link that acts as an intermediary en route to the final destination XML's X links allows to specify multiple or group linked locators.

  Linking and Querying

There are six different areas that need to be addressed while dealing with linking and querying. They are as follows.

XML information set - The World Wide Web Consortium (W3C)' s document defines what an XML information set is. It says that XML information set comprises various pieces of information, which together make up the XML document.

Xlink is W3C' s mechanism for linking to other resources within an XML document. Xlink also allows no-XML document to be linked together. XPath is the general language specification for addressing parts of an XML document framed by W3C' s.

XPointer is W3C' s mechanism for pointing to a particular location within an XML document.

XML fragment Interchange for transmitting a part of XML document as per W3C specification.

Querying XML document -XML document can be queried using XSLT technology recommended by W3C, which is dealt with in the later part of the session.

  XML information set

The XML information set, or Infoset is a working draft created by W3C to describe various pieces of information that together form an XML document. There are fifteen distinct types of information that forms the XML document. They are represented in the table as shown.

Exactly one document information item.
One or more element information items.
Attribute information items.
Processing instruction information items.
Character information items.
Reference to skipped entity information items.
Comment information items.
A document type declaration information items.
Entity information items.
Notation information items.
Entity start marker information items.
Entity end marker information items.
CDATA start marker information items.
CDATA end marker information items.
Namespace declaration items.

  Link elements

HTML has two link elements namely, A and IMG, whereas in XML links, the link elements are identified by the element attributes.

Any XML element can act as a link element provided it has the right kind of attributes.

<|ELEMENT CORRELATION ANY> <!ATTLIST CORRELATION xlink:form CDATA #FIXED value>

The primary attribute that identifies the XML element as a link is the xlink:form attribute, whose declaration in an XML DTD, would be as shown . Here the value should be a locator and not the linking elements. Also the value can be simple or extended.

  Locators

XML links work with link elements. The link elements in turn contain locators.

Locators are in the form of attributes or other elements that points to specific locations.
In general, a locator is a URI, a fragment identifier, or a URI combined with a fragment identifier. Locators for XML documents are extended pointers.

The syntax of locators allows us to use the two variations as shown here.
URI#fragment - This fetches the whole of the resource identified by the URI and then extracts the part identified by the fragment identifier.

URI|fragment - The application can decide how it will process the URI in order to extract the resource. This could be used to retrieve a particular part of the document.

If the fragment identifier is a character string, the string is treated as the value of the id attribute of an XML element. For instance, the locator sample.html#sa2 would point to the element with attribute value of sa2 in the file sample.html.

  XLinks

XML' s Xlinks are used to establish hyperlinks in XML documents.

The W3C Xlink working draft defines two categories of links. They are, simple links and extended links.

The xml:link attribute is used for specifying a link or location term as shown here.

xml:link="simple"| "extended" | "locator" | "group" | "document"

The figure here shows the outline classification of XML links.

Back Next


Copyrights : Layout Galaxy All Rights Reserved
No part of this tutorial may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, electrostatic, magnetic tape, mechanical or otherwise, without prior permission in writing from Layout Galaxy.




17, Vadsarvala Nivas, 65-A, J. Nehru Road, Mulund (W), Mumbai - 400 080 INDIA
Tel : 91-22-21645588, 91-22-21640585 Fax : 91-22-21641545
Email : ionline@vsnl.com
© Image Online 2001-2003