精图规范1.0----22 向后兼容 BackwardsCompatibility

previous  next   contents   elements   attributes   properties   index  


04 September 2001

22 向后兼容 BackwardsCompatibility

一个用户代理(UA)也许没有处理和查看精图内容的能力。下面介绍了两种与精图内容的向后兼容性相关的情景:A user agent (UA) might not have the ability to process and view SVGcontent. The following list outlines two of the backwards compatibilityscenarios associated with SVG content:

  • 因为XML具有嵌入精图内容的能力,故认定具有某种替换表示的能力,例如可以使用'switch'元素和特性检测的功能(正如SMIL 1.0规范所描述的[SMIL1])。For XML grammars with the ability to embed SVG content, it is assumed that some sort of alternate representation capability such as the 'switch' element and some sort of feature-availability test facility (such as what is described in the SMIL 1.0 specification [SMIL1]) will be available.

这个'switch'元素和和特性检测的功能(或其等价物)用于建议XML文档的作者为精图内容提供一种替换的表示,例如一种图片或者一个文本字串。下面的例子说明如何在SMIL 1.0文档中嵌入精图使得当用户代理不支持精图时显示一个图片来代替精图的显示。注意"type"属性中的MIME类型是一种让用户代理确定是否能解码引用媒体的重要方式。This 'switch' element and feature-availability test facility (ortheir equivalents) are the recommended way for XML authors to provide analternate representation to SVG content, such as an image or a text string. Thefollowing example shows how to embed an SVG drawing within a SMIL 1.0 documentsuch that an alternate image will display in the event the user agent doesn'tsupport SVG. Note that the MIME type in the "type" attribute is animportant means for the user agent to decide if it can decode the referencedmedia.

在这个例子中,精图内容是通过URL引用来包含的。在某些父级XML文法内可以在同一文件中直接嵌入精图片断。In this example,the SVG content is included via a URL reference. With some parent XML grammarsit will also be possible to include an SVG document fragment inline within thesame file as its parent grammar.

 
<?xml version="1.0" standalone="yes"?>
<smil>
  <body>
    <!-- With SMIL 1.0, the first child element of 'switch'
         which the SMIL 1.0 user agent is able to process 
         and which tests true will get processed and all other 
         child elements will have no visual effect. In this case, 
         if the SMIL 1.0 user agent can process "image/svg+xml", 
         then the SVG will appear; otherwise, the alternate image 
         (the second child element) will appear. -->
    <switch>
      <!-- Render the SVG if possible. -->
      <ref type="image/svg+xml" src="drawing.svg" />
 
      <!-- Else, render the alternate image. -->
      <img src="alternate_image.jpg" />
    </switch>
  </body>
</smil>

·        对于HTML 4.0,精图绘画可以通过使用'object'元素将其嵌入。一个代替的表示例如图片可以作为'object'元素内容的一部分。在这种情况下,精图内容通常通过URL引用来包含。下列例子说明如何通过'object'元素包含通过URL引用精图并且在用户代理不支持精图的显示时用一个图片代替精图的显示:For HTML 4.0, SVG drawings can be embedded using the 'object'element. An alternate representation such as an image can be included as thecontent of the 'object' element. In this case, the SVG content usually will beincluded via a URL reference. The following example shows how to use the'object' element to include an SVG drawing via a URL reference with an imageserving as the alternate representation in the absence of an SVG user agent:

·                 
·                <html>
·                  <body>
·                    <object type="image/svg+xml" data="drawing.svg">
·                      <!-- The contents of the 'object' element (i.e., an alternate
·                         image) are drawn in the event the user agent cannot process 
·                         the SVG drawing. -->
·                      <img src="alternate_image.jpg" alt="alternate description" />
·                    </object>
·                  </body>
·                </html>

previous  next   contents   elements   attributes   properties   index  

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值