1. Trang chủ
  2. » Công Nghệ Thông Tin

XML in 60 Minutes a Day phần 8 potx

72 197 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 72
Dung lượng 9,3 MB

Nội dung

Figure 12.9 The <par> element. The W3C groups media objects as follows: ■■ Those with an intrinsic (that is, built-in) duration; also called continu- ous media. Examples are videos and audio files. ■■ Those without intrinsic duration; also called discrete media. Examples are text files and still images. Each visual media object, for example, a video image, is displayed by the SMIL player in an individual region within the root-layout region, or the viewport, if those two areas coincide. The regions are treated as containers. <body> <par> <img src="SpaceGems_sm_logo.gif" alt="Space Gems, Inc." region="SGI_reg05" dur="20s" /> <audio src="SpaceGemsTheme.wav" begin="2s" repeat="3" end="30s" /> <text src="SG_sales.txt" alt="Welcome to Space Gems!" region="SGI_text_reg01" begin="1s" dur="10s" /> </par> </body> Seconds SpaceGems_sm_logo.gif SpaceGemsTheme.wav 30s SG_sales.txt 5 0 10 15 20 Media object Name 474 Chapter 12 422541 Ch12.qxd 6/19/03 10:12 AM Page 474 The media objects are associated with them by URI references used as values for the src attribute within the start tag for the media object element. For example, if we want to insert an actual visual image (in this case, let’s say it’s a GIF graphic image), we can insert an <img> element within the <body> element and use code similar to the following: <img src=”dia_ring_sm_logo.gif” alt=”Space Gems Rings!” region=”SGI_reg01” /> Notice that the value of the region attribute in the <img> element start tag is identical to the value given to the id attribute inside the start tag of the respec- tive <region> element inside the <layout> element. Thus, the value is a pointer to the respective region and links the two components together. Try to ensure that the category into which a media object is placed is appropriately reflected in the element name. This facilitates readability and searchability of the SMIL document. For example, it would be confusing to create a series of elements with image-related names if some actually contained audio or animation references. If there is doubt about how to categorize a media object (for example, some animation objects are considered to be video), rely on the more generic element name <ref>. Table 12.3 lists the attributes that are applicable to all media object elements. Most are probably familiar; they’ve been mentioned and defined in tables per- taining to other elements. Table 12.3 Media Object Elements Attributes ATTRIBUTE NAME EXPLANATION abstract Brief content description. alt For viewers/players that cannot display a particular object; specifies alternate message. Strongly recommended for all object elements. author Content author’s name. begin The time for the explicit beginning of an element (seconds). Two types: clock-based delay-value and event-value. clip-begin Specifies the beginning of a subclip of a continuous object as offset from the object’s start. Various formats, syntaxes. (continued) SMIL 475 422541 Ch12.qxd 6/19/03 10:12 AM Page 475 Table 12.3 (continued) ATTRIBUTE NAME EXPLANATION clip-end Specifies the end of a subclip of a continuous object that should be played. Same syntax as clip-begin. copyright Content’s copyright notice. dur The explicit duration of an element (seconds). end The explicit end of an element (seconds). fill Attribute that determines the effective end of the child element and the parent. id Unique identifier. longdesc Specifies a URI link to a longer object description. Should supplement the description provided by alt. region Specifies the abstract rendering surface defined within the <layout> elements. src URI of the media object. system-bitrate Specifies the approximate bandwidth. system-captions Determines whether closed captioning will be on or off. system-language Value is a comma-separated list of language names (RFC 1766). Determines whether there is a match between end-user system and objects. system-overdub-or-caption Determines whether end users prefer overdubbing or captioning when they are available. system-required Specifies the name of an extension (for example, namespaces). system-screen-size True if the SMIL viewer is capable of displaying a resolution of the given size (“width x height” in pixels). system-screen-depth Specifies the depth of the screen color palette in bits per pixel. title All <seq> elements should have a title attribute with a meaningful description. type Type of media object referenced by src. 476 Chapter 12 422541 Ch12.qxd 6/19/03 10:12 AM Page 476 It is important to consider including the alt attribute in the start tag for all media objects. There is a two-fold reason for including alt: ■■ If the object fails to play or display, the author still has an opportunity to send some message to the end user. ■■ If the alt message appears, it signals the author or end user that there are malfunctions in the document, the browser, or other SMIL-related applications. Finally, anchors and links can be attached to visual media objects, too. One way to do so is to include an <anchor> element within the extent of a media object element. The <switch> Element The <switch> element was mentioned just prior to the <body> element sec- tion, earlier in this chapter. As we discussed briefly there, we are listing it twice because it can be nested within the <head> or <body> element. The <switch> element provides SMIL with the ability to adapt a presenta- tion according to the capabilities and other properties of the end user’s system. The adaptability is provided through specific child elements, whose attributes allow the execution of one or more boolean true/false tests against the system settings. The first set of child elements whose attribute tests all prove to be true is executed. Any child element that contains no test attributes is, by default, automatically considered to be true. The <switch> element syntax resembles the following code: <switch> <! Test 1 > <elementname test-attribute=”value” /> <! Test 2 > <elementname test-attribute=”value” /> </switch> Here are the elements that are used as children of <switch>: ■■ The media object elements <animation>, <audio>, <img>, <ref>, <text>, <textstream>, and <video> ■■ The synchronization elements <par> and <seq> ■■ <a>, <anchor>, and <switch> Table 12.4 lists the test attributes that can appear in those child elements. SMIL 477 422541 Ch12.qxd 6/19/03 10:12 AM Page 477 Table 12.4 <switch> Test Attributes TEST ATTRIBUTE NAME EXPLANATION <elementname system language= End user’s system language. Values are a “langcode” /> list of two character language codes (examples: en, fr, es, de; see RFC 1766), delimited by commas <elementname system bitrate= Approximate bandwidth. Value is a single “integer value” /> integer value (examples: 9600, 14400, 28800, 56000). <elementname system screen size= Monitors screen resolution. Value is “integerxinteger” /> composed of two integers indicating the width and the height in pixels, in that order, and separated by an x (example: “800x600”). <elementname system Color definition expressed in the number screen depth= “integer” /> of bits per pixel. The value is an integer. Choices are 4 (indicating 16 colors), 8 (256 colors), 16 (65,536 colors), or 24 (16.78 million colors, also called true color). <elementname system-captions= True if closed captioning has been “on | off” /> activated; false if closed captioning is not activated. <elementname system-overdub-or- Determines whether end users prefer caption= “caption | overdub” /> overdubbing or captioning when the option is available. Evaluates to true if the end-user preference matches this attribute value; to false if there is no match. <elementname system-required= Specifies the name of an extension (for “namespace | others” example, a namespace supporting additional element types). Evaluates to true if the extension is supported by the implementation. Otherwise, evaluates to false. For example, what if you are aware that some of your end users prefer to communicate in Spanish, or that others have monitors that are capable of 800x600-pixel resolution only? How do you code your SMIL document to anticipate communicating with those users? Here is one possible solution: <body> <switch> <!- - English Language - -> <par system-language=”en”> <text src=”SGI_english.doc” region=”SGI_reg_07” /> 478 Chapter 12 422541 Ch12.qxd 6/19/03 10:12 AM Page 478 <switch> <!- - English Language Screen Rez - -> <text src=”800x600_SGI_eng.doc” region=”SGI_reg07” system-screen-size=”800x600” /> <text src=”1024x768_SGI_eng.doc” region=”SGI_reg07” system-screen-size=”1024x768” /> <text src=”other_SGI_eng.doc” region=”SGI_reg07” /> </switch> </par> <!- - Spanish Language - -> <par system-language=”es”> <text src=”SGI_espanol.doc” region=”SGI_reg07” /> <switch> <!- - Spanish Language Screen Rez - -> <text src=”800x600_SGI_esp.doc” region=”SGI_reg07” system-screen-size=”800x600” /> <text src=”1024x768_SGI_esp.doc” region=”SGI_reg07” system-screen-size=”1024x768” /> <text src=”other_SGI_esp.doc” region=”SGI_reg07” /> </switch> </par> </switch> </body> There are other solutions besides this one. If you have the time, we invite you to create your own. SMIL’s Hyperlinking Elements Occasionally, you may want to link SMIL with other SMIL or non-SMIL appli- cations or plug-ins: ■■ A SMIL browser may use an HTML plug-in to display an embedded HTML page. ■■ An HTML browser may use a SMIL plug-in to display a SMIL document embedded in an HTML page. To create access points, you can use the SMILlink elements: <a> or <anchor>. Both enable you to describe inline navigational links between objects. The SMIL 1.0 Recommendation lists several linking rules. Meanwhile, here are a few worth remembering: ■■ SMIL provides for unidirectional, single-headed (that is, one source/one destination) inline links only. ■■ SMIL supports the locators currently used in HTML, including name fragment identifiers and the # connector. So, for example, SMIL parsers should understand and use fragmented object locators, such as http://SpaceGems.com/cat_files/catalog2047#diam_img29. SMIL 479 422541 Ch12.qxd 6/19/03 10:12 AM Page 479 The fragment part is an ID value that identifies one of the elements within the referenced SMIL document. If a link containing a fragment part is followed, the presentation should start as though the end user had fast- forwarded through a remote destination document to the beginning of the element designated by the fragment. ■■ If the object addressed by the link has a repeat attribute with a value of more than 1 or indefinite, all of the specified repetitions of the object will be played. Furthermore, if the object addressed by the link is con- tained within a parent element that contains its own repeat attribute, those repetitions are played, too. ■■ It is forbidden to link to elements that are the content of <switch> elements. Although we present introductory lessons and simple examples of SMIL links, we recommend that if you are going to use links in your SMIL docu- ments, you study the SMIL Recommendation in detail (www.w3.org/TR/ REC-smil/; SMIL 2.0, at www.w3.org/TR/smil20/). The <a> Element The <a> element is used to link with a complete media object, as opposed to the <anchor> element, which facilitates linking to parts of other media objects. The <a> element can contain the following child elements: <animation>, <audio>, <img>, <par>, <ref >, <seq>, <switch>, <text>, <textstream>, and <video>. The <a> element does not influence the synchronization (that is, the ordering or timing) of its child elements. However, <a> elements may not be nested within one another. Table 12.5 lists the attributes that are applicable to the <a> element. Although the functionality of the <a> element is similar to the functionality of the <A> element in HTML, SMIL includes the show attribute in an <a> element, which controls the temporal behavior of the source document after the link on that document has been followed. Here is an example of an <a> element link that starts up a new video pre- sentation in a new window: <a href=”http://www.SpaceGems.com/cat_2047_spring.smi” title= “Sale Items – Spring 2047” show=”new” > <video id=”import_sgi_vid47q2” region= “SGI_vidreg01” /> </a> 480 Chapter 12 422541 Ch12.qxd 6/19/03 10:12 AM Page 480 Table 12.5 <a> Element Attributes ATTRIBUTE NAME EXPLANATION href Specifies the URI of the link’s destination. This attribute is required for <a> elements. id Unique identifier. show Controls the behavior of the source document containing the link when the link is followed. Possible values: replace (current presentation is paused and replaced by the destination resource; default value); new (presentation of the destination resource starts in a new context, not affecting the source resource); pause (source presentation is paused, and the destination resource starts in a new context). title All <anchor> elements should have a title attribute. The value for title should include a meaningful description of the linked media object. The following is a link that activates a replacement presentation, instead of the original presentation that contained the link. It allows a SMIL player to spawn from an HTML browser: <a href=”budget_guide_2047.smil” show=”new” region=”SGI_adminreg04”> Click here for 2047 exploration budget preparation guidelines. Please submit your regional plans and estimates by 2047-02-28! </a> The <anchor> Element As mentioned in the <a> element section, the <a> element enables you to cre- ate a link with another complete media object. On other occasions, though, it might be useful to create links to (just) spatial or temporal subparts of another media object. SMIL’s <anchor> element enables you to do that. Using its id and href attributes, you can identify the target media object. Then, using its coords attribute, you can break the media object into spatial subparts. Alternatively, using its begin and end attributes, you can break it into temporal subparts. Table 12.6 lists all the attributes applicable to the <anchor> element. This element, however, does not allow for child elements. The explanation of the coords attribute contains a reference to Figure 12.10. SMIL 481 422541 Ch12.qxd 6/19/03 10:12 AM Page 481 Table 12.6 <anchor> Element Attributes ATTRIBUTE NAME EXPLANATION begin The time for the explicit beginning of an element (seconds). Two types: clock-based delay-value and an event-value. The value is relative to the beginning of the destination media object. coords Specifies a rectangle within the display area of a visual media object. Coordinates are relative to the top-left corner of the visual media object (see Figure 12.10). Values are left-x,top-y,right-x,bottom-y (for example, coords=”50,10,200,110”). If specified as percentages (that is, coords= “10%,10%,55%,40%”), the values are relative to the total width or height of the media object display area. end The explicit end of an element (seconds). Value is relative to the beginning of the destination media object. href Contains the URI of the link’s destination. id Unique identifier. show Controls the behavior of the source document containing the link when the link is followed. Possible values: replace (current presentation is paused and replaced by the destination resource; default value); new (presentation of the destination resource starts in a new context, not affecting the source resource); pause (source presentation is paused, and the destination resource starts in a new context). skip-content Introduced for future extensibility. Possible values are true (ignore the content of this element) or false (process the content of this element). title Like <a>, all <anchor> elements should have a title attribute. The title should include a meaningful description of the linked media object. Following is a link that is associated with a video concerning Space Gems exploration techniques on the Patella Regina planet in the 51 Pegasi system. The <video> element automatically links to a portion of a tour presentation made by the Patella Regina mine manager: <video id= “pat_reg_mgr_tour29” region=”SGI_vid_reg08”> <anchor show=”pause” href=”http://www.SpaceGems.com/pat_reg_tour_2047.mpg” begin=”20s” end=”81s” /> </video 482 Chapter 12 422541 Ch12.qxd 6/19/03 10:13 AM Page 482 Figure 12.10 <anchor> element; coords attribute schematic (see Table 12.6). The following example shows how to navigate to Patella Regina. The <img> element automatically links to a specific portion of a star map graphic stored locally: <img id= “Peg51_map” region=”SGI_navreg29”> <anchor show=”new” href=”\exploration\maps\Pegasi51\route_direct03.jpg” coords=”60,30,270,90” /> </img Chapter 12 Labs: Getting Started with SMIL In these labs, you work with some very basic SMIL 1.0 media objects. For this lab to work properly, though, you have to install a RealPlayer display applica- tion on your system. After that, you create a SMIL file and then add some display (for example, image, text and video) information, plus some synchro- nization code, to make the Space Gems site more interesting. You will recog- nize how Internet Explorer displays an XHTML file and how that file calls your SMIL file. (0,0) bottom-y top-y left-x right-x SMIL 483 422541 Ch12.qxd 6/19/03 10:13 AM Page 483 [...]... assign meaning to resources in such a way that a machine or, more properly, a code engine can actually understand something about the nature of the data That way, RDF provides a measure of interoperability RDF RDF can be used in a variety of application areas: ■ ■ Resource discovery, by providing better search engine capabilities ■ ■ Cataloging, by allowing a developer to describe the content and content... book has been through the use of DTDs, beginning with Chapter 4, and schemas, beginning with Chapter 5 We will discuss metadata in this chapter and again in our discussion of the Channel Definition Format in Chapter 14, “CDF.” As we’ll see throughout the rest of this chapter, metadata in a proper and standard framework plays a major role in RDF and its related standards The W3C, PICS, and RDF In 1995,... Mozilla.org uses RDF to develop applications with the intention of integrating and aggregating Internet resources RDF is used to support Aurora a single-user interface program for managing bookmarks, history, search results, filesystems, and other resources that can be reflected in an RDF data model—and Mozilla’s SmartBrowsing metadata services For information regarding Mozilla and RDF, visit Mozilla’s... SMIL-compliant yet, and neither is Windows Media Player So we decided to create an Internet Explorer file that has similar timing, synchronization, and display features as a SMIL file In Lab 12.3, you launch a real SMIL file using the RealOne Player that you just installed 1 Download the following files from the Chapter 12 page of the XML in 60 Minutes a Day Web site, described in the book’s introduction, and... accessing, and using the information in a meaningful way The Web was originally built for human legibility and interpretation, and although the information on it is machine-readable (we are able to access it with our various computer systems, after all), it is not as machine-understandable as we want or need it to be Humans perform most access and management functions more or less manually Because of the... faster, and better focused because search engines will have more and better search information available Better and faster automated software agents will roam the Web, looking for information or transacting business on our behalf Information could be accessed, analyzed, extracted, sorted, styled, and otherwise manipulated to create customized documents for people or machines Thus, data publishing and... markup languages Metadata, the concept of information about information (to use just one of the catchy phrases listed previously), is related to metamarkup Metadata, when added to a Web document by its developers, describes how, when, and by whom a particular set of data has been collected, and how the data is formatted Metadata has become essential for understanding information stored in databases everywhere... provides a standard way for using XML to represent metadata in the form of statements about properties and relationships of any Web resource Examples include the title, author, and modification date of a Web page; copyright and licensing information about a Web document; or other descriptive information RDF provides a model for representing metadata that is even more general than the PICS metadata model,... of XML It provides some relief for Web information search problems and for the proliferation of automated crawlers or agents that roam the Web searching for information Given a mechanism that allows more precise descriptions of data or information, Web documents rise from machine-readable to something more akin to machineunderstandable or, at least, machine-processible So, with RDF, we attempt to assign... or relating to semantics.” In turn, the term semantics is defined as “the study of meanings.” The Semantic Web is a vision and a goal shared by the W3C and many Web-oriented organizations Its major objective is the defining and linking of Web data so that it can be used by systems not just for display purposes, but also for automation, integration, and reuse across various applications The Semantic . the linked media object. The following is a link that activates a replacement presentation, instead of the original presentation that contained the link. It allows a SMIL player to spawn from an. media objects: ■■ Streaming media is a technology for transferring and displaying audio, video, and other multimedia data in real time over a network (includ- ing the Internet) and displaying. should include a meaningful description of the linked media object. Following is a link that is associated with a video concerning Space Gems exploration techniques on the Patella Regina planet in

Ngày đăng: 14/08/2014, 12:20

TỪ KHÓA LIÊN QUAN