XPath Introduction

● ●

XPath is a language for finding information in an XML  document.  XPath is used to navigate through elements and attributes in  an XML document. What is XPath?

    * XPath is a syntax for defining parts of an XML document     * XPath uses path expressions to navigate in XML documents     * XPath contains a library of standard functions     * XPath is a major element in XSLT( EXtensible Stylesheet  Language).     * XPath is a W3C recommendation

In XPath, there are seven kinds of nodes: element, attribute, text, namespace, processing-instruction, comment, and document (root) nodes. <?xml version="1.0" encoding="ISO8859-1"?> <bookstore> <book> <title lang="en">Harry Potter</title> <author>J K. Rowling</author> <year>2005</year> <price>29.99</price> </book> </bookstore>

Example of nodes in the XML  document above:
<bookstore> (document node) <author>J K. Rowling</author> (element node) lang="en" (attribute node) Atomic values Atomic values are nodes with no children or parent. Example of atomic values: J K. Rowling "en"

Items are atomic values or nodes. Relationship of Nodes Parent
Each element and attribute has one parent. In the following example; the book element is the parent of the title, author, year, and price: <book> <title>Harry Potter</title> <author>J K. Rowling</author> <year>2005</year> <price>29.99</price> </book>

Children Element nodes may have zero, one or more children. In the following example; the title, author, year, and price elements are all children of the book element: <book> <title>Harry Potter</title> <author>J K. Rowling</author> <year>2005</year> <price>29.99</price> </book>

Nodes that have the same parent. In the following example; the title, author, year, and price elements are all siblings: <book> <title>Harry Potter</title> <author>J K. Rowling</author> <year>2005</year> <price>29.99</price> </book>

A node's parent, parent's parent, etc. In the following example; the ancestors of the title element are the book element and the bookstore element: <bookstore> <book> <title>Harry Potter</title> <author>J K. Rowling</author> <year>2005</year> <price>29.99</price> </book> </bookstore>

Descendants A node's children, children's children, etc. In the following example; descendants of the bookstore element are the book, title, author, year, and price elements: <bookstore> <book> <title>Harry Potter</title> <author>J K. Rowling</author> <year>2005</year> <price>29.99</price> </book> </bookstore>

XPath uses path expressions to select nodes or node­sets in an XML document.  The node is selected by following a path or steps.

<?xml version="1.0" encoding="ISO-8859-1"?> <bookstore> <book> <title lang="eng">Harry Potter</title> <price>29.99</price> </book> <book> <title lang="eng">Learning XML</title> <price>39.95</price> </book> </bookstore>

Selecting Nodes

XPath uses path expressions to select nodes in an XML document.  The node is selected by following a path or steps. The most useful  path expressions are listed below:

In the table below we have listed some path expressions and the result  of the expressions:

Predicates are used to find a specific node or a node that contains a  specific value.

Predicates are always embedded in square brackets


Selecting Unknown Nodes
XPath wildcards can be used to select unknown XML elements.

Selecting Several Paths By using the | operator in an XPath expression you can select several paths.

Xpath Axes

In the table, we have listed some path expressions and the result of the expressions:

XPath Axes
An axis defines a node-set relative to the current node.

Location Path Expression
A location path can be absolute or relative. An absolute location path starts with a slash ( / ) and a relative location  path does not. In both cases the location path consists of one or more  steps, each separated by a slash:

XPath Operators

 Video, Audio and the Switch Element     (SMIL)
Adding video and audio media to your presentation is just as easy as adding images. The only difference is that we use the <video> and <audio> tags instead of <img> tags. These tags also take a lot of the same attributes such as src, region, begin, dur, etc. To add some audio, or more specifically a RealMedia (.rm) file, we add this tag to our SMIL document, <audio src="moo.rm" />. Below is what our code should look like now.

When it comes to video, it's just like adding another image. ● First, create a region to hold the video, then specify the video with the <video> tag. ● Include the location of the video file in the src attribute of the <video> tag. ● With the <switch> tag, we can optimize the presentation to fit the user's situation. ● All the content tags, i.e., <img>, <video>, <audio>, <par>, <seq>, etc., have attributes that you use along with <switch> such as system-screen-size, system-bitrate and system-language. The SMIL parser then selects the media that best suits the user's needs using these attributes.

What this does is chooses only one <audio> tag to use based on the user's bitrate. For example, if someone views this SMIL presentation with a 28kbps modem, they'll get the "moo-28k.rm" file. On the other hand, if someone views it with something else not specified, they'll get the "moo-other.rm" file since that has no "system-bitrate" attribute and is deemed the default.

Building and Indexing a Distributed Multimedia Presentation Archive using SMIL

Generation of Metadata for Composite Mixed-Media Digital Objects

Metadata Processing Steps for Lecture Archive

illustrates the metadata processing and generation components for this application.

Spatial Layout for a Simple SMIL Example

Replay Interface for a SMIL Presentation Lecture

Presentation Capture 1. Filming a lecturer giving a PowerPoint presentation; 2. Digitizing and encoding the video footage to MPEG format (for analysis) and RealMedia format (for streaming); 3. Analysing the digitized footage or logging data to determine the times at which slide changes occur; 4. Using the temporal information to generate a SMIL presentation which integrates synchronized digital video and PowerPoint slides with a timeline for browsing and jumping directly to a particular slide.

Overview of System Components and Process Flow

PresentationIndexer application.

Presentation Archive Search

Presentation Browse and Replay Interface

Sign up to vote on this title
UsefulNot useful

Master Your Semester with Scribd & The New York Times

Special offer for students: Only $4.99/month.

Master Your Semester with a Special Offer from Scribd & The New York Times

Cancel anytime.