您的位置:程序门 -> web 开发 -> xml/soap



rdf文件中 xmls:rdf是什么意思


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


rdf文件中 xmls:rdf是什么意思[已结贴,结贴人:wm219]
发表于:2008-02-21 17:15:49 楼主
html code
<?xml version="1.0"?> <rdf:rdf xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:cd="http://www.recshop.fake/cd#"> <rdf:description rdf:about="http://www.recshop.fake/cd/empire burlesque"> <cd:artist>bob dylan</cd:artist> <cd:country>usa</cd:country> <cd:company>columbia</cd:company> <cd:price>10.90</cd:price> <cd:year>1985</cd:year> </rdf:description> <rdf:description rdf:about="http://www.recshop.fake/cd/hide your heart"> <cd:artist>bonnie tyler</cd:artist> <cd:country>uk</cd:country> <cd:company>cbs records</cd:company> <cd:price>9.90</cd:price> <cd:year>1988</cd:year> </rdf:description>. </rdf:rdf>



上面代码中:   xmlns:rdf是什么意思?网上说命名空间,不明白,好像(xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns
访问网址超出本站范围,不能确定是否安全  
继续访问   取消访问http://www.w3.org/1999/02/22-rdf-syntax-ns#")   中网址不能改吧
 
还有   xmlns:dc   又是什么意思?后面的网址可不可以改啊
 
最后:   rdf中的标签可不可以随便写啊,比如   <abc> fdsfdsfsd </abc>


发表于:2008-02-21 18:54:111楼 得分:15
xmlns:
是一个关键字,用于定义默认的命名空间,省去给每一个元素名指定前缀的麻烦
xmlns:xx="uri"
除了一些代表w3c规范的特定uri以外,理论上xmlns:xx="uri"中的uri可以不指向一个实际的文档或目录,只要保证在xml文档中的唯一性便可。

最后:    
        可以

//别重复发贴!另外建议多关注一下xml!他的基础知识了解一下对程序员还是有利而无害的
发表于:2008-02-22 08:17:252楼 得分:0
楼上的老师,   "命名空间"   是什么意思?
后面的   http://www.recshop.fake/cd#   这个网址又起到了什么作用?   且   http://www.recshop.fake/cd这个网址打不开,为什么?

谢谢
发表于:2008-02-22 08:58:373楼 得分:0
df中的标签可不可以随便写啊,比如       <abc>   fdsfdsfsd   </abc>  
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~``

rdf里的东西会有一个模式规定它怎么写,不能随便写的。

rdf   记得好像是资源描述框架的意思。  
发表于:2008-02-22 09:06:374楼 得分:0
xiaofanku   老师,刚才我搜了命名空间,

我的理解是:  

比如有两个变量,它们的变量名都是:   var

可在   一个文件中,一个变量名能有一个函意,所以就有了命名空间来区分开同名变量

如一个命名空间的uri文件里:   http://www.w3.org/1999/02/22-rdf-syntax-ns#   里定义了   rdf里的var
另一个命名空间的uri文件里:     http://www.recshop.fake/cd#   里定义了   cd里的var

是不是这个意思呢?

小弟还有个问题不是很清楚,如果我上述的观点是正确的,那么   http://www.w3.org/1999/02/22-rdf-syntax-ns#     里的var是怎么定义的?用什么语言定义的?

最后,我对uri的理解不太清楚,能用通俗点的词语来描术一下吗?

谢谢!!
发表于:2008-02-22 09:08:485楼 得分:0
回复:toperray  
          rdf里的东西会有一个模式规定它怎么写,不能随便写的。

这是个什么样的模式?我怎么没找到,谢谢
发表于:2008-02-22 09:09:196楼 得分:5
c++里面的namespace类似。

发表于:2008-02-22 12:59:557楼 得分:0
命名空间:防止一份文档内两个相同的元素存在不同的语义,所以加以前缀区别他们
发表于:2008-02-22 13:05:278楼 得分:0
http://www.w3.org/1999/02/22-rdf-syntax-ns#:
若uri中存在文档元素格式的定义规范:哪只能按格式要求写,
可以自定义规范:dtd或   schema格式,然后把该规范放在一个url下!那么可以用它来约束xml文档的格式(哪些可以出现,以及相应的位置,可能的取值)
发表于:2008-02-22 13:13:549楼 得分:0
好像打错了:
如果哪个url:http://www.w3.org/1999/02/22-rdf-syntax-ns#
存在规范的定义.dtd或schema,哪么必须按要求的格式写,你看一下:http://www.w3.org/1999/02/22-rdf-syntax-ns#
内的内容:
the   rdf   vocabulary   (rdf)
      this   is   the   rdf   schema   for   the   rdf   vocabulary   defined   in   the   rdf   namespace.
    type
    the   subject   is   an   instance   of   a   class.
 
    property
    the   class   of   rdf   properties.
   
    statement    
    the   class   of   rdf   statements.
   
    subject
    the   subject   of   the   subject   rdf   statement.
   
    predicate
    the   predicate   of   the   subject   rdf   statement.
   
    object
    the   object   of   the   subject   rdf   statement.
   
    bag
    the   class   of   unordered   containers.
   
    seq
    the   class   of   ordered   containers.
   
    alt
    the   class   of   containers   of   alternatives.
   
    value
    idiomatic   property   used   for   structured   values.
   
    list
    the   class   of   rdf   lists.
   
    nil
    the   empty   list,   with   no   items   in   it.   if   the   rest   of   a   list   is   nil   then   the   list   has   no   more   items   in   it.

    first
    the   first   item   in   the   subject   rdf   list.
   
    rest
    the   rest   of   the   subject   rdf   list   after   the   first   item.
   
    xmlliteral
    the   class   of   xml   literal   values.
发表于:2008-02-22 13:26:4010楼 得分:0
个人认为它定义的规范不是很严格!我认为可以自已重新定义,
像:
<rdf:rdf
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"   >

<rdf:   a> bob   dylan </a>
    <rdf:b> usa </b>
    <rdf:c> columbia </c>
    <rdf:d> 10.90 </d>
    <rdf:e> 1985 </e>
</rdf:description>
再来看一份规范:
<xsd:attributegroup   name="beanattributes">
?
<xsd:attribute   name="name"   type="xsd:string">
?
<xsd:annotation>
?
<xsd:documentation>

can   be   used   to   create   one   or   more   aliases   illegal   in   an   (xml)   id.
multiple   aliases   can   be   separated   by   any   number   of   spaces,   commas,
or   semi-colons   (or   indeed   any   mixture   of   the   three).

</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
?
<xsd:attribute   name="class"   type="xsd:string">
?
<xsd:annotation>
?
<xsd:documentation   source="java:java.lang.class">

the   fully   qualified   name   of   the   bean's   class,   except   if   it   pure   serves   as   parent   for   child   bean   definitions.

</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
发表于:2008-02-22 14:18:3611楼 得分:0
看看孙鑫老师的视频教程,上面讲得很清楚;
发表于:2008-02-22 14:25:0212楼 得分:0
虽然现在我对   "rdf   命令空间的定义",仍是一无所知,但我十分感楼上二楼的回复,特别是   xiaofanku   老师还提供出许多示例,及xiaofanku   老师   "建议多关注一下xml!他的基础知识"   的这段建议   ,我会加油的!


快速检索

最新资讯
热门点击