新书推介:《语义网技术体系》
作者:瞿裕忠,胡伟,程龚
   XML论坛     W3CHINA.ORG讨论区     计算机科学论坛     SOAChina论坛     Blog     开放翻译计划     新浪微博  
 
  • 首页
  • 登录
  • 注册
  • 软件下载
  • 资料下载
  • 核心成员
  • 帮助
  •   Add to Google

    >> 本版讨论XLink, XPointer, XQuery
    [返回] 中文XML论坛 - 专业的XML技术讨论区XML.ORG.CN讨论区 - XML技术『 XQuery/XLink/XPointer/ 』 → XLink Syntax--XLink语法 查看新帖用户列表

      发表一个新主题  发表一个新投票  回复主题  (订阅本版) 您是本帖的第 6494 个阅读者浏览上一篇主题  刷新本主题   树形显示贴子 浏览下一篇主题
     * 贴子主题: XLink Syntax--XLink语法 举报  打印  推荐  IE收藏夹 
       本主题类别:     
     xml-linguist 帅哥哟,离线,有人找我吗?
      
      
      等级:大三暑假(参加全国数模竞赛拿了一等奖)
      文章:121
      积分:869
      门派:XML.ORG.CN
      注册:2007/3/28

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给xml-linguist发送一个短消息 把xml-linguist加入好友 查看xml-linguist的个人资料 搜索xml-linguist在『 XQuery/XLink/XPointer/ 』的所有贴子 引用回复这个贴子 回复这个贴子 查看xml-linguist的博客楼主
    发贴心情 XLink Syntax--XLink语法

    In HTML, we know (and all the browsers know!) that the <a> element defines a hyperlink. However, this is not how it works with XML. In XML documents, you can use whatever element names you want - therefore it is impossible for browsers to predict what hyperlink elements will be called in XML documents.

    The solution for creating links in XML documents was to put a marker on elements that should act as hyperlinks.

    Below is a simple example of how to use XLink to create links in an XML document:

    <?xml version="1.0"?>
    <homepages xmlns:xlink="http://www.w3.org/1999/xlink">

    <homepage xlink:type="simple"
              xlink:href="http://www.w3schools.com"> Visit W3Schools</homepage>
                      
    <homepage xlink:type="simple"
              xlink:href="http://www.w3.org"> Visit W3C</homepage>
    </homepages>

    To get access to the XLink attributes and features we must declare the XLink namespace at the top of the document.

    The XLink namespace is: "http://www.w3.org/1999/xlink".

    The xlink:type and the xlink:href attributes in the <homepage> elements define that the type and href attributes come from the xlink namespace.

    The xlink:type="simple" creates a simple, two-ended link (means "click from here to go there"). We will look at multi-ended (multidirectional) links later.
    --------------------------------------------------------------------------------

    HTML中,由<a>元素定义链接。但是在XML中不是这样。XML中的任何元素都可以是链接起点。这样,做资料的简单,但浏览器并不认识。

    针对这一问题的解决方案就是在作为链接起点的元素上作标记。以下就是XML文件中运用XLink来生成链接的示例:
    <?xml version="1.0"?>
    <homepages xmlns:xlink="http://www.w3.org/1999/xlink">

    <homepage xlink:type="simple"
              xlink:href="http://www.w3schools.com"> Visit W3Schools</homepage>
                      
    <homepage xlink:type="simple"
              xlink:href="http://www.w3.org"> Visit W3C</homepage>
    </homepages>

    要获取XLink属性中的资源,必须在文件中声明XLink的名称空间。以上文件中的XLink名称空间就是:"http://www.w3.org/1999/xlink"。

    在<homepage>元素中的xlink:type和xlink:href属性都源自xlink名称空间。

    xlink:type="simple"所创建的是一个简单链接,即“点击这里就到了那里”的这种点对点连接。多点链接是另一个话题了。


       收藏   分享  
    顶(0)
      




    ----------------------------------------------
    有些事,我只需要知道是否可以做,我不一定非得学会怎么做。

    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2007/4/12 9:29:00
     
     GoogleAdSense
      
      
      等级:大一新生
      文章:1
      积分:50
      门派:无门无派
      院校:未填写
      注册:2007-01-01
    给Google AdSense发送一个短消息 把Google AdSense加入好友 查看Google AdSense的个人资料 搜索Google AdSense在『 XQuery/XLink/XPointer/ 』的所有贴子 访问Google AdSense的主页 引用回复这个贴子 回复这个贴子 查看Google AdSense的博客广告
    2024/5/12 18:29:03

    本主题贴数1,分页: [1]

    管理选项修改tag | 锁定 | 解锁 | 提升 | 删除 | 移动 | 固顶 | 总固顶 | 奖励 | 惩罚 | 发布公告
    W3C Contributing Supporter! W 3 C h i n a ( since 2003 ) 旗 下 站 点
    苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
    359.375ms