分类目录归档:不是技术

刻盘全攻略zz

http://www.edisc.com.cn/bike/viewnews.btml?id=621

刻录设备的CD-R、CD-RW不仅能方便地对数据进行备份,同时还可以自己制作音乐CD、VCD等。下面就对刻录设备作一个介绍。

  一、刻录设备

 

  1、CD-R

  CD-R(CD-Recorder)简单地讲,就是可以一次写入、多次读出的光盘刻录机。CD-R的工作原理就是在空白的CD盘片上烧制出

小坑

也就是记录数据的反射点。CD-R的数据格式和CD-ROM相同,因此,所有经CD-R刻出的盘都可以在普通的CD-ROM上顺利读出。CD-R规格是由菲利浦公司和索尼公司共同制定并于1990年颁布,雅马哈公司在同年推出了第一部2倍速CD-R驱动器。CD-R与普通的光驱一样,也有内置和外置之分。现在国内市场上便宜的CD-R已经降到2000元左右,内置式较外置式便宜四、五百。SCSI接口的CD-R仍是主流产品,不过现在市场上IDE接口的CD-R已经越来越多。CD-R刻录机的读取速度一般为2速、4速、6速、8速,而写入速度通常为2速或4速。

  

  CD-R技术采用高功率激光照射CD-R光盘的染料层,产生化学变化,化学变化后就无法恢复原来的状态,所以不能重复写入。

  

  CD-R盘片主要由4层组成,它的感光层都使用有机染料(ODM,Organic

DyeMaterial)制成。CD-R盘片目前主要有金、绿、蓝三种颜色,其中绿色盘片最常见。它使用的染料对光的敏感度较高,对刻录激光的适应范围较大,兼容性最好;金盘可以保存很长时间,因为它所使用的染料抗光性更好;蓝盘的特点在于非常低的区域错误率和最高的数据

清晰度

,很适合用于制作VCD和Audio

CD,而且还有防刮涂层,可以很好地抗紫外线,兼容性很好。目前市面上最常见的CD-R盘片是12厘米的容量主要有:650MB、680MB乃至更高。对于650MB的盘片,记录时间为74分钟。刻录好的CD-R绿盘寿命为70年,蓝、金盘可保存100年。应注意的是空白的CD-R盘片的寿命比刻录好的盘片要短,一般到10年就不能写了。目前CD-R盘片的价格在5~15元之间。

  

  2、CD-RW

  

  CD-RW的全称是CD-ReWritable,代表一种

重复写入

技术。CD-RW刻录机能够反复擦写CD-RW光盘的原理主要是

相变

技术

同CD-R一样利用激光的大功率照射,对光盘本身的感光物质进行瞬间的加温。和CD-R不同的是进行了相位转换,用以记录数据。由此可以制造出能够被读取的反射点,而且这些类似小

的反射点可以被重复烧制。由于CD-RW盘片可重复写入,因此每张较CD-R盘片贵100元左右,而且只有在高速光驱(24速以上CD-ROM)才能读出。但CD-RW驱动器的价格却并不比CD-R驱动器贵多少。

  

  CD-RW是由日本理光公司首先推出的,盘片主要由6层组成,盘面一般呈淡灰色,与CD-ROM比较接近。因为结构比较复杂,并且使用了稀有金属合金,所以CD-RW盘片的价格要贵。目前市面上只有12厘米一种CD-RW盘片,容量也只有标准的650MB。CD-RW盘片的寿命主要取决于写入的次数。写入一次后不再写入,它的寿命大约在30到50年左右。

  

  3、PD

  

  PD是Phsae

Change

ReWritable

Optical

Disk的缩写,它是松下公司采用相变光方式(PhsaeChange)存储的可重复擦写存储设备,是一种比CD-RW性能更好、运行更稳定的光盘介质驱动器。所谓

相变光

主要是利用介质的相变来记录数据。

  

  PD驱动器的运行速度较低,可以兼容CD-ROM。使用专门PD光盘,可重复擦写大约50万次。PD的平均寻址时间为89ms,数据传输率为518~1141KB/s,相当于八速光驱,写入并效验时的数据传输率为300~600KB/s,相当于四速光驱。除了可以读写PD光盘外,也可以当作普通的八倍速CD-ROM使用。内置式的PD目前市场售价大约为2000元左右,盘片也较贵,650MB盘片的售价为150元左右。

  

  4、DVD-RAM

  

  DVD-RAM采用了0.74um道宽和0.41um/位高密度记录线等新技术,因此DVD盘片虽然看起来和普通的CD并没有什么区别,但是却有着更大的存储容量。单面单层DVD容量为4.7G,单面双层DVD为9.4G,而双面双层容量达17G。另外DVD-RAM可重复擦写,而且盘片的成本比目前的CD成本高不了多少。DVD-RAM还实现了低成本向下兼容。但目前DVD-RAM驱动器的价格较贵,在3000元以上,同时软件方面的支持欠缺。

  二、光盘刻录格式  

  常见的光盘刻录格式有以下几种:

  

  1、ISO-9660:简称ISO,是当前唯一通用的光盘文件系统,任何类型的电脑和所有的刻录软件都支持它。如果想让所有的CD-ROM都能读取刻录好的光盘,就必须使用ISO文件系统。ISO-9660目前有两个标准:Level

1和Level

2。Level

1和Level

2的区别在于Level

2允许使用长文件名,但不支持DOS。

  

  2、Rock

Ridge:支持UNIX系统的ISO-9660文件系统,支持文件名字母大小写、符号字符以及长文件名,由于兼容ISO-9660,所以即使操作系统不支持Rock

Ridge,也可以通过ISO-9660查看。

  

  3、HFS:苹果公司的MAC机使用的光盘文件系统。

  

  4、Joliet:微软公司自定义的光盘文件系统,也是ISO-9660的一种扩展,支持WIN9x/NT和DOS。在支持WIN9x/NT下文件名最多可显示64个字符,并可使用中文。

  

  5、Romeo:这是由著名的接口厂家Adaptec公司自定义的文件系统,支持WIN9x/NT,文件名最多可达128个字符,并可使用中文,但不支持DOS。

  

  6、UDF:UDF是统一光盘格式。它采用标准的封装写入技术(PW,Packet

Writing),可将刻录盘当作硬盘来使用,任意在光盘上修改和删除文件。在刻录之

前,要首先将刻录进行格式化操作,CD-RW盘片格式化后的容量要减少近100MB。

  三、光盘的刻录方式

  1、整盘刻录:(Disc

At

Once,即DAO)这种写入模式主要用于光盘的复制,一次完成整张光盘的刻录。其特点是能够复制出来的光盘与源盘完全一样。DAO写入方式可以轻松完成对于音乐CD、混合类型CD-ROM等数据轨之间存在间隙的光盘复制,且可以确保数据结构与间隙长度都完全相同,值得一提的是,对于DAO方式一些小的失误都可能导致整张光盘彻底报废,所以它对数据传送的稳定性和驱动器的性能要求较高。

  

  2、轨道刻录:(Track

At

Once,即TAO)以轨道为单位的刻录方式。它支持向一个区段分多次写入若干轨的数据,主要应用于制作音乐光盘和混合、特殊类型光盘。

  

  3、飞速刻录:(On

The

Fly,即OTF)一种很常用的刻录方式,在早期,由于计算机运算速度无法满足要求,所以只能在刻录前将数据预先转换成使用ISO-9660格式的Image

File,然后在进行刻录;目前的电脑处理速度已经可以实现完全实时转换,这种将数据自动实时转换成ISO-9660格式,然后进行刻录的方式就叫飞速写入。

  

  4、区段刻录:(Session

At

Once,即SAO)这种写入模式一次只刻录一个区段而非整张光盘,余下的光盘空间下次可以继续使用;常用于多区段CD-ROM的制作。其优点是适合于制作合集类光盘。但每次刻录新区段时都要占用约13MB左右的光盘空间用于存储该区段的结构以及上一段的联结信息,并为建立下个区段作好准备。因此区段过多会浪费较多的光盘空间。

  

  5、封装写入:(Packet

Writing,即PW)主要用于制作UDF或CD-RFS光盘所使用的方式,对驱动器有一定的要求。

  

  目前绝大多数新出品的CD-R/CD-RW都支持这几种刻录方式。因此,至于采用哪种就取决于刻录软件的能力了。

  四、刻录设备的选购

 

  1、关于接口形式

  

  一般的刻录设备按照结构形式有内置和外置两种。内置产品节省空间,价格便宜;外置产品易于散热、独立供电、便于携带,但价格较贵。从经济的角度考虑,内置刻录机是家庭用户更好的选择,不但价格便宜而且传输稳定,但如果需要一次大量刻盘则需要考虑散热问题。

  

  刻录设备的接口形式主要有:IDE、SCSI、并口三种。IDE接口与常用的IDE硬盘相同,优点是价格相对较便宜,安装简单。安装内置刻录机就像安装硬盘一样简单;现在多数的CD-R/CD-RW刻录机都采用SCSI接口,它性能更稳定,但需要附加一块SCSI控制器,安装较复杂,价格较贵,目前外置的SCSI接口刻录机是最贵的;并口分为SPP、EPP、ECP三种,其中在使用SPP、EPP高速模式接口时,刻录机才能达到6速读取、2速刻录,SPP只能达到2速读、单速写,安装并口刻录机时,应注意模式设置。

  

  2、关于数据缓存

  

  刻录机内部都有一个数据缓存器,用来作为将数据写入光盘时的暂存区。如果数据进入缓存的速度低于离开缓存的速度,就会发生欠载运行,导致坏盘产生。大容量缓存对刻录的稳定性,尤其是IDE接口产品起到相当大的作用。因此选购4速以上产品最好具备2MB或更多的缓存器。不过对于2速产品由于数据流量低,具有1MB或512KB的缓存就足够了。

  

  3、关于Firmware又称韧体。

  

  它对于CD-R/RW刻录机的关系就如同BIOS和主板的关系,每种型号的CD-R/RW刻录机,都有其特殊的Firmware,而大多数刻录软件,都依靠Firmware来辨认刻录机的品牌和特性。

  

  4、关于防尘设计

  

  由于刻录机的激光头是水平向上发射聚焦激光束来实现刻录的,灰尘就很容易落在激光头上并被烧结,造成激光束聚焦不良直接影响正常刻录。因此,有防尘设计的刻录机才能更好的长时间稳定工作。

  

  5、CD-R还是CD-RW

  

  CD-R和CD-RW的区别前面已经讲过,CD-RW更为先进。从性能上讲,CD-RW绝对是首选。但CD-RW的盘片是CD-R盘片的近十倍。从目前普通用户使用的情况来看,更多的用户是用刻录光盘将数据永久性的保存,所以更多用户更愿意使用价格较为便宜的CD-R一次性刻录盘片。

  五、盘片的保护

  1、阳光对于盘片有破坏性是不争的事实。有人曾做过实验,在一场阳光浴后,几乎所有的台湾盘片在一周以内损坏,先是刻过的区域变成金黄色,然后是整张盘片变成金黄色。国外盘片,也最多不过两周内损坏。从实验看金片比绿片对阳光的免疫力强,蓝片最差。

  

  2、在光盘上帖标签对盘片的损坏极大,同时当光盘在光盘机中高速旋转时,也会产生重心不稳的情况,对光盘机的读取会产生一定程度的影响,所以,标签这种东西还是少贴为好。

  

  3、刮光盘的两面对光盘都会产生损坏。有人认为光盘的背面是封面而已,可以随意刮,其实在薄薄的印刷面底下就是资料存储用的染料层,一旦染料层受损,资料就全完了。

  

  4、刻录盘片也是会发霉的,长期放在潮湿阴暗的环境中,刻录面会生出一层霉菌,运气好的话,擦一下就擦掉了,运气不好的话,资料面可能就毁了。因此收藏时要注意避免潮湿。

  六、刻录软件

  目前的刻录软件很多,在此向大家推荐三种刻录软件:

  

  1、Direct

CD美国Adaptec公司的一款刻录软件,主要功能是可以使用UDF的技术将CD-R/RW的盘片当作硬盘使用,但先要对两者进行格式化。它是一款较好的多段刻录软件,目前CD-RW刻录机都赠送Direct

CD软件,普及率极高。

  

  2、Easy

CD

Creator也是美国Adaptec公司的产品。除了能制作VCD外,还能制造数据光盘、音乐光盘、插页和标签。在刻录的形式上,除了硬盘

光盘模式外,还有光盘

光盘的对拷模式。

  

  3、CD-Maker

Pro是美国NTI(Newtech

Infosystems

Inc)公司开发的CD刻录软件,选用它的目的在于:它可以完成许多刻录工作。如刻录数据光盘、多段式光盘、音乐CD、多模式CD等,还支持光盘对拷。

  4、NERO系列,AHEAD公司的NERO刻录软件非常出名,简单易用,功能齐全,是不可多得的好工具(光驱家园有该软件的详细介绍)。

libjingle

最近在忙着看这个,发现示例实在太少,尤其是那个TunnelSessionClient和TunnelSession的用法,头都大了。

把0.2.0、0.3.0、0.4.0都下来了看了一下examples。

libjingle从0.2.0开始提供pcp的样例程序,到了0.4.0是通过实现一个httpserver和httpclient的方式来做这个pcp文件传输的。

而0.2.0和0.3.0都是用的TunnelSession*。我现在需要把一些直连的tcp应用改成p2p,无疑是TunnelSession*的一套更适合了。

libjingle的文档很多,然而很不适用,我觉得更好的方式是把ChangeLog做一个说明。

BTW: 打死p2p和nat穿透,tnnd,我不是做网络出身的嘛

一个折腾了半小时的问题

原因是工作机的windows启动的时候老是提示我有个dll找不到。

于是我去注册表找,

发现HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\WinSock2\Parameters\NameSpace_Catalog5\Catalog_Entries\000000000005

这一项就是那个dll所在,一看是以前某个乱七八糟的流氓软件注册的。于是很爽快的删掉,连备份都没有。

然后网络就出问题了。IP获取不了,所有网卡的IP都丢了,等等。

到别的机器上看,也没有这一项,那么这项本来就应该是该删的。

重启几次,依然故我。。。

而且系统进入的速度其慢无比。

总算进来了,嗯,再regedit看看父路径的父路径上:

HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\WinSock2\Parameters\NameSpace_Catalog5

有这么一个Key:Num_Catalog_Entries,还是5,于是改回4,系统马上正常了。

。。。

所以,手动改注册表最好还是先把相关的项搞清楚。

土得掉渣了 我

把UltraVNC的工程改成DLL,发现能启动,但是密码改不了,连接那里老是Not listening……

于是调试.

搞了两三天才发现,是调用这个dll的mfc项目没有直接支持winsock……

终于搞定了这个BlogBar

看到

楼里梦

那里有blogbar这个咚咚,感觉挺好玩,于是想在blogbus这里加上。

这个链接是教你怎么加blogbar的:

http://www.spankbot.net/cgi-bin/nph-bear/000000A/http/www.google.com/uds/solutions/blogbar/reference.html

blogbus的模版可以改,然而变量是写死的。

唯一需要修改是这一段:

var options = {

largeResultSet : false,

resultStyle : GSblogBar.RESULT_STYLE_EXPANDED,

title :

title here

,

autoExecuteList : {

executeList : [

word1

,

word2

,

word3

]

}

};

executeList应该是一个数组,而blogbus给的变量

!– ~ b_cat ~ —

是带格式的

还是用正则表达式把它们切开。

var vlists =

!– ~ b_cat ~ —

;

var myReg = /

a href=\

\/s[0-9]+\/\

([\w\W]+?)

\/a

/g;

var ccc = new Array();

var i = 0;

while (myReg.test(vlists)) {

ccc[i++] = RegExp.$1;

}

var options = {

largeResultSet : false,

resultStyle : GSblogBar.RESULT_STYLE_EXPANDED,

title :

!– ~ b_cat ~ —

,

autoExecuteList : {

executeList : ccc

}

};

看了一下,效果还好,现在才发现自己的tag名字起得很不得人心

Flex里的所谓自作聪明

今天被自己耍了一次

还是FF和IE上的表现不同,FF上怎么都有,IE里怎么都出不来。

删掉applicationComplete之后就正常,加上就不正常,而程序根本一行都没有跑过。

一切都是construction~initialization之间发生的事情。

debug版的player是for Mozilla的,只好先装一个for windows

IE的。

发现最后出在一个空的变量名遍寻不获的地方。找了一下,发现自己用UI开发的方法,把DataProvider设成

然后IE的player就去找这个

所指代的object,当然是找不到。

本来是初期调试的时候,把DataProvider设了一个有效值,然后发现要动态修改,所以先把它设成空字符串……

不过IE的flashplayer为什么就这么笨呢

Flex中的Application的启动顺序

今天写了个小的flex,结果发现在ff的flashplayer上跑得很好,而在IE的flashplayer上不行。找了一下原因。

Application的启动顺序如下:

1. 实例化Application对象

2. 初始化Application.systemManager

3. Application在初始化过程之前, 派发预初始化事件.

4. 调用createChild(). 此时, 所有应用组件被创建, 所有组件的createChild()被调用.

5. Application派发初始化事件, 表明所有的组件初始化完毕.

6. 派发creationComplete事件

7. Application对象添加到显示列表中

8. 派发applicationComplete事件

第一次我是把引用Application.application.parameters(以下简称Aaps)的句式写在creationComplete事件中,然而IE下根本执行不了,我的默认调试浏览器又是FF,于是颇为恼火。

由于这个过程对一些组件产生了影响。

然后把这个东西改成在applicationComplete中执行,就work了。

得出结论是:

假设Aaps可以随时获取,那么IE和FF的flashplayer初始化组件的动作,发生的时段是不一样的,或者说是两者的初始化做的事情并不完全相同。IE中的5

FF中的5,IE中的7

FF中的7

我猜的

总之放在applicationComplete中做就好了,甭管那么多。

团队的问题

团队个人之间的不信任现在慢慢地体现出来了。本来就不是一个团结的整体,有这样的情况也非常的正常,对吧。

资金是有的,然而几个问题要弄清晰一些。

第一,这是谁的公司。拖了那么久仍然没有批下来?

第二,对外交谈时候应该谁来主导

第三,经营方向。方向决定了一切,包括招人,包括技术方案的方向,还有各种。

来无耻一下,贴一下XCAP的draft

妈的,都过期了还没新的出来么?SIMPLE J. RosenbergInternet-Draft Cisco SystemsExpires:

April 16, 2007

October 13, 2006 The Extensible Markup Language (XML) Configuration Access Protocol (XCAP) draft-ietf-simple-xcap-12Status of this Memo By submitting this Internet-Draft, each author represents that any applicable patent or other IPR claims of which he or she is aware have been or will be disclosed, and any of which he or she becomes aware will be disclosed, in accordance with Section 6 of BCP 79. Internet-Drafts are working documents of the Internet Engineering Task Force (IETF), its areas, and its working groups. Note that other groups may also distribute working documents as Internet- Drafts. Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as

work in progress.

The list of current Internet-Drafts can be accessed at http://www.ietf.org/ietf/1id-abstracts.txt. The list of Internet-Draft Shadow Directories can be accessed at http://www.ietf.org/shadow.html. This Internet-Draft will expire on April 16, 2007.Copyright Notice Copyright (C) The Internet Society (2006).Abstract This specification defines the Extensible Markup Language (XML) Configuration Access Protocol (XCAP). XCAP allows a client to read, write and modify application configuration data, stored in XML format on a server. XCAP maps XML document sub-trees and element attributes to HTTP URIs, so that these components can be directly accessed by HTTP.Rosenberg Expires April 16, 2007 [Page 1] Internet-Draft XCAP October 2006Table of Contents 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 4 2. Overview of Operation . . . . . . . . . . . . . . . . . . . . 4 3. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 5 4. Definitions . . . . . . . . . . . . . . . . . . . . . . . . . 5 5. Application Usages . . . . . . . . . . . . . . . . . . . . . . 7 5.1. Application Unique ID (AUID) . . . . . . . . . . . . . . . 7 5.2. Default Document Namespace . . . . . . . . . . . . . . . . 8 5.3. Data Validation . . . . . . . . . . . . . . . . . . . . . 9 5.4. Data Semantics . . . . . . . . . . . . . . . . . . . . . . 10 5.5. Naming Conventions . . . . . . . . . . . . . . . . . . . . 10 5.6. Resource Interdependencies . . . . . . . . . . . . . . . . 11 5.7. Authorization Policies . . . . . . . . . . . . . . . . . . 12 5.8. Data Extensibility . . . . . . . . . . . . . . . . . . . . 12 5.9. Documenting Application Usages . . . . . . . . . . . . . . 13 5.10. Guidelines for Creating Application Usages . . . . . . . . 13 6. URI Construction . . . . . . . . . . . . . . . . . . . . . . . 15 6.1. XCAP Root . . . . . . . . . . . . . . . . . . . . . . . . 15 6.2. Document Selector . . . . . . . . . . . . . . . . . . . . 16 6.3. Node Selector . . . . . . . . . . . . . . . . . . . . . . 18 6.4. Namespace Bindings for the Selector . . . . . . . . . . . 23 7. Client Operations . . . . . . . . . . . . . . . . . . . . . . 24 7.1. Create or Replace a Document . . . . . . . . . . . . . . . 25 7.2. Delete a Document . . . . . . . . . . . . . . . . . . . . 26 7.3. Fetch a Document . . . . . . . . . . . . . . . . . . . . . 26 7.4. Create or Replace an Element . . . . . . . . . . . . . . . 26 7.5. Delete an Element . . . . . . . . . . . . . . . . . . . . 28 7.6. Fetch an Element . . . . . . . . . . . . . . . . . . . . . 29 7.7. Create or Replace an Attribute . . . . . . . . . . . . . . 30 7.8. Delete an Attribute . . . . . . . . . . . . . . . . . . . 31 7.9. Fetch an Attribute . . . . . . . . . . . . . . . . . . . . 31 7.10. Fetch Namespace Bindings . . . . . . . . . . . . . . . . . 32 7.11. Conditional Operations . . . . . . . . . . . . . . . . . . 32 8. Server Behavior . . . . . . . . . . . . . . . . . . . . . . . 34 8.1. POST Handling . . . . . . . . . . . . . . . . . . . . . . 35 8.2. PUT Handling . . . . . . . . . . . . . . . . . . . . . . . 35 8.2.1. Locating the Parent . . . . . . . . . . . . . . . . . 35 8.2.2. Verifying Document Content . . . . . . . . . . . . . . 36 8.2.3. Creation . . . . . . . . . . . . . . . . . . . . . . . 37 8.2.4. Replacement . . . . . . . . . . . . . . . . . . . . . 41 8.2.5. Validation . . . . . . . . . . . . . . . . . . . . . . 42 8.2.6. Conditional Processing . . . . . . . . . . . . . . . . 43 8.2.7. Resource Interdependencies . . . . . . . . . . . . . . 44 8.3. GET Handling . . . . . . . . . . . . . . . . . . . . . . . 44 8.4. DELETE Handling . . . . . . . . . . . . . . . . . . . . . 45 8.5. Managing Etags . . . . . . . . . . . . . . . . . . . . . . 46 9. Cache Control . . . . . . . . . . . . . . . . . . . . . . . . 46Rosenberg Expires April 16, 2007 [Page 2] Internet-Draft XCAP October 2006 10. Namespace Binding Format . . . . . . . . . . . . . . . . . . . 47 11. Detailed Conflict Reports . . . . . . . . . . . . . . . . . . 47 11.1. Document Structure . . . . . . . . . . . . . . . . . . . . 48 11.2. XML Schema . . . . . . . . . . . . . . . . . . . . . . . . 49 12. XCAP Server Capabilities . . . . . . . . . . . . . . . . . . . 53 12.1. Application Unique ID (AUID) . . . . . . . . . . . . . . . 54 12.2. XML Schema . . . . . . . . . . . . . . . . . . . . . . . . 54 12.3. Default Document Namespace . . . . . . . . . . . . . . . . 55 12.4. MIME Type . . . . . . . . . . . . . . . . . . . . . . . . 55 12.5. Validation Constraints . . . . . . . . . . . . . . . . . . 55 12.6. Data Semantics . . . . . . . . . . . . . . . . . . . . . . 56 12.7. Naming Conventions . . . . . . . . . . . . . . . . . . . . 56 12.8. Resource Interdependencies . . . . . . . . . . . . . . . . 56 12.9. Authorization Policies . . . . . . . . . . . . . . . . . . 56 13. Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 14. Security Considerations . . . . . . . . . . . . . . . . . . . 59 15. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 60 15.1. XCAP Application Unique IDs . . . . . . . . . . . . . . . 60 15.2. MIME Types . . . . . . . . . . . . . . . . . . . . . . . . 61 15.2.1. application/xcap-el+xml MIME Type . . . . . . . . . . 61 15.2.2. application/xcap-att+xml MIME Type . . . . . . . . . . 62 15.2.3. application/xcap-ns+xml MIME Type . . . . . . . . . . 63 15.2.4. application/xcap-error+xml MIME Type . . . . . . . . . 64 15.2.5. application/xcap-caps+xml MIME Type . . . . . . . . . 65 15.3. URN Sub-Namespace Registrations . . . . . . . . . . . . . 66 15.3.1. urn:ietf:params:xml:ns:xcap-error . . . . . . . . . . 66 15.3.2. urn:ietf:params:xml:ns:xcap-caps . . . . . . . . . . . 66 15.4. XML Schema Registrations . . . . . . . . . . . . . . . . . 67 15.4.1. XCAP Error Schema Registration . . . . . . . . . . . . 67 15.4.2. XCAP Capabilities Schema Registration . . . . . . . . 67 16. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . 68 17. References . . . . . . . . . . . . . . . . . . . . . . . . . . 68 17.1. Normative References . . . . . . . . . . . . . . . . . . . 68 17.2. Informative References . . . . . . . . . . . . . . . . . . 70 Author

s Address . . . . . . . . . . . . . . . . . . . . . . . . . 71 Intellectual Property and Copyright Statements . . . . . . . . . . 72Rosenberg Expires April 16, 2007 [Page 3] Internet-Draft XCAP October 20061. Introduction In many communications applications, such as Voice over IP, instant messaging, and presence, it is necessary for network servers to access per-user information in the process of servicing a request. This per-user information resides within the network, but is managed by the end user themselves. Its management can be done through a multiplicity of access points, including the web, a wireless handset, or a PC application. There are many examples of per-user information. One is presence [20] authorization policy, which defines rules about which watchers are allowed to subscribe to a presentity, and what information they are allowed to access. Another is presence lists, which are lists of users whose presence is desired by a watcher [26]. One way to obtain presence information for the list is to subscribe to a resource which represents that list [21]. In this case, the Resource List Server (RLS) requires access to this list in order to process a SIP [16] SUBSCRIBE [28] request for it. Another way to obtain presence for the users on the list is for a watcher to subscribe to each user individually. In that case, it is convenient to have a server store the list, and when the client boots, it fetches the list from the server. This would allow a user to access their resource lists from different clients. This specification describes a protocol that can be used to manipulate this per-user data. It is called the Extensible Markup Language (XML) Configuration Access Protocol (XCAP). XCAP is a set of conventions for mapping XML documents and document components into HTTP URIs, rules for how the modification of one resource affects another, data validation constraints, and authorization policies associated with access to those resources. Because of this structure, normal HTTP primitives can be used to manipulate the data. XCAP is based heavily on ideas borrowed from the Application Configuration Access Protocol (ACAP) [25], but it is not an extension of it, nor does it have any dependencies on it. Like ACAP, XCAP is meant to support the configuration needs for a multiplicity of applications, rather than just a single one.2. Overview of Operation Each application (where an application refers to a use case that implies a collection of data and associated semantics) that makes use of XCAP specifies an application usage (Section 5). This application usage defines the XML schema [2] for the data used by the application, along with other key pieces of information. The principal task of XCAP is to allow clients to read, write, modify,Rosenberg Expires April 16, 2007 [Page 4] Internet-Draft XCAP October 2006 create and delete pieces of that data. These operations are supported using HTTP/1.1 [6]. An XCAP server acts as a repository for collections of XML documents. There will be documents stored for each application. Within each application, there are documents stored for each user. Each user can have a multiplicity of documents for a particular application. To access some component of one of those documents, XCAP defines an algorithm for constructing a URI that can be used to reference that component. Components refer to any element or attribute within the document. Thus, the HTTP URIs used by XCAP point to a document, or to pieces of information that are finer grained than the XML document itself. An HTTP resource which follows the naming conventions and validation constraints defined here is called an XCAP resource. Since XCAP resources are also HTTP resources, they can be accessed using HTTP methods. Reading an XCAP resource is accomplished with HTTP GET, creating or modifying one is done with HTTP PUT, and removing one of the resources is done with an HTTP DELETE. XCAP resources do not represent processing scripts; as a result, POST operations to HTTP URIs representing XCAP resources are not defined. Properties that HTTP associates with resources, such as entity tags, also apply to XCAP resources. Indeed, entity tags are particularly useful in XCAP, as they allow a number of conditional operations to be performed. XML documents which are equivalent for the purposes of many applications may differ in their physical representation. With XCAP resources, the canonical form with comments [19] of an XML document determines the logical equivalence. In other words, the canonical specification determines, how significant whitespace MUST be processed and for example, that new inserted attributes may appear in any order within the physical representation.3. Terminology In this document, the key words

MUST

,

MUST NOT

,

REQUIRED

,

SHALL

,

SHALL NOT

,

SHOULD

,

SHOULD NOT

,

RECOMMENDED

,

MAY

, and

OPTIONAL

are to be interpreted as described in RFC 2119 [7] and indicate requirement levels for compliant implementations.4. Definitions The following terms are used throughout this document:Rosenberg Expires April 16, 2007 [Page 5] Internet-Draft XCAP October 2006 XCAP Resource: An HTTP resource representing an XML document, an element within an XML document, or an attribute of an element within an XML document that follows the naming and validation constraints of XCAP. XCAP Server: An HTTP server that understands how to follow the naming and validation constraints defined in this specification. XCAP Client: An HTTP client that understands how to follow the naming and validation constraints defined in this specification. Application: A collection of software components within a network whose operation depends on data managed and stored on an XCAP server. Application Usage: Detailed information on the interaction of an application with the XCAP server. Application Unique ID (AUID): A unique identifier within the namespace of application unique IDs created by this specification that differentiates XCAP resources accessed by one application from XCAP resources accessed by another. Naming Conventions: The part of an application usage that specifies well-known URIs used by an application, or more generally, specifies the URIs that are typically accessed by an application during its processing. XCAP User Identifier (XUI): The XUI is a string, valid as a path element in an HTTP URI, that is associated with each user served by the XCAP server. XCAP Root: A context that contains all of the documents across all application usages and users that are managed by the server. Document Selector: A sequence of path segments, with each segment being separated by a

/

, that identify the XML document within an XCAP root that is being selected. Node Selector: A sequence of path segments, with each segment being separated by a

/

, that identify the XML node (element or attribute) being selected within a document. Node Selector Separator: A single path segment equal to two tilde characters

~~

that is used to separate the document selector from the node selector within an HTTP URI.Rosenberg Expires April 16, 2007 [Page 6] Internet-Draft XCAP October 2006 Document URI: The HTTP URI containing the XCAP root and document selector, resulting in the selection of a specific document. As a result, performing a GET against the document URI would retrieve the document. Node URI: The HTTP URI containing the XCAP root, document selector, node selector separator and node selector, resulting in the selection of a specific XML node. XCAP Root URI: An HTTP URI that representing the XCAP root. Although a syntactically valid URI, the XCAP Root URI does not correspond to an actual resource on an XCAP server. Actual resources are created by appending additional path information to the XCAP Root URI. Global Tree: A URI that represents the parent for all global documents for a particular application usage within a particular XCAP root. Home Directory: A URI that represents the parent for all documents for a particular user for a particular application usage within a particular XCAP root. Positional Insertion: A PUT operation that results in the insertion of a new element into a document such that its position relative to other children of the same parent is set by the client.5. Application Usages Each XCAP resource on a server is associated with an application. In order for an application to use those resources, application specific conventions must be specified. Those conventions include the XML schema that defines the structure and constraints of the data, well known URIs to bootstrap access to the data, and so on. All of those application specific conventions are defined by the application usage.5.1. Application Unique ID (AUID) Each application usage is associated with a name, called an Application Unique ID (AUID). This name uniquely identifies the application usage within the namespace of application usages, and is different from AUIDs used by other applications. AUIDs exist in one of two namespaces. The first namespace is the IETF namespace. This namespace contains a set of tokens, each of which is registered with IANA. These registrations occur with the publication of standards track RFCs [27] based on the guidelines in Section 15. The secondRosenberg Expires April 16, 2007 [Page 7] Internet-Draft XCAP October 2006 namespace is the vendor-proprietary namespace. Each AUID in that namespace is prefixed with the reverse domain name of the organization creating the AUID, followed by a period, followed by any vendor defined token. As an example, the example.com domain can create an AUID with the value

com.example.foo

but cannot create one with the value

org.example.foo

. AUIDs within the vendor namespace do not need to be registered with IANA. The vendor namespace is also meant to be used in lab environments where no central registry is needed. The syntax for AUIDs, expressed in ABNF [12] (and using some of the BNF defined in RFC 3986 [13]) is: AUID = global-auid / vendor-auid global-auid = auid auid = 1*auid-char vendor-auid = rev-hostname

.

auid rev-hostname = toplabel *(

.

domainlabel ) domainlabel = alphanum / alphanum *( alphanum /

) alphanum toplabel = ALPHA / ALPHA *( alphanum /

) alphanum auid-char = auid-unreserved / pct-encoded / sub-delims /

:

/

@

auid-unreserved = ALPHA / DIGIT /

/

_

/

~

The allowed characters for the auid production is a subset of the pchar production defined in RFC3986. In particular, it omits the

.

, which allows for the auid to be separated from the reverse hostname.5.2. Default Document Namespace In order for the XCAP server to match a URI to an element or attribute of a document, any XML namespace prefixes used within the URI must be expanded [3]. This expansion requires a namespace binding context. That context maps namespace prefixes to namespace URIs. It also defines a default namespace that applies to elements in the URI without namespace prefixes. The namespace binding context comes from two sources. Firstly, the mapping of namespace prefixes to namespace URIs is obtained from the URI itself (see Section 6.4). However, the default document namespace is defined by the application usage itself, and applies to all URIs referencing resources within that application usage. All application usages MUST define a namespace URI that represents the default document namespace to be used when evaluating URIs. The default document namespace does not apply to elements or attributes within the documents themselves – it applies only to the evaluation of URIs within that application usage. Indeed, the term

default document namespace

is distinct from the term

default namespace

. The latter has the standard meaning withinRosenberg Expires April 16, 2007 [Page 8] Internet-Draft XCAP October 2006 XML documents, and the former refers to the default used in evaluation of XCAP URIs. XCAP does not change in any way the mechanisms for determining the default namespace within XML documents. However, if a document contains a URI representing an XCAP resource, the default document namespace defined by the application usage applies to that URI as well.5.3. Data Validation One of the responsibilities of an XCAP server is to validate the content of each XCAP resource when an XCAP client tries to modify one. This is done using two mechanisms. Firstly, all application usages MUST describe their document contents using XML schema [2]. The application usage MUST also identify the MIME type for documents compliant to that schema. Unfortunately, XML schemas cannot represent every form of data constraint. As an example, one XML element may contain an integer which defines the maximum number of instances of another element. This constraint cannot be represented with XML schema. However, such constraints may be important to the application usage. The application usage defines any additional constraints beyond those in the schema. Of particular importance are uniqueness constraints. In many cases, an application will require that there only be one instance of some element or attribute within a particular scope. Each uniqueness constraint needs to be specified by identifying the field, or combinations of fields, that need to be unique, and then identifying the scope in which that uniqueness applies. One typical scope is the set of all elements of a certain name within the same parent. Another typical scope is the set of all URIs valid within a particular domain. In some cases these constraints can be specified using XML schema, which provides the

unique

element for this purpose. Other uniqueness constraints, such as URI uniqueness across a domain, cannot be expressed by schema. Whether or not the schema is used to express some of the uniqueness requirements, the application usage MUST specify all uniqueness requirements when it defines its data validation needs. For example, the resource lists application usage [22] requires that each

list

element have a unique value for the

name

attribute within a single parent. As another example, the RLS services application usage [22] requires that the value of the

uri

attribute of the

service

element be a URI that is unique within the domain of the URI. URI constraints represent another form of constraints. These areRosenberg Expires April 16, 2007 [Page 9] Internet-Draft XCAP October 2006 constraints on the scheme or structure of the scheme specific part of the URI. These kinds of constraints cannot be expressed in an XML schema. If these constraints are important to an application usage, they need to be explicitly called out. Another important data constraint is referential integrity. Referential integrity is important when the name or value of an element or attribute is used as a key to select another element or attribute. An application usage MAY specify referential integrity constraints. However, XCAP servers are not a replacement for Relational Database Management Systems (RDBMS), and therefore clients MUST NOT depend on servers to maintain referential integrity. XCAP clients are responsible for making all of the appropriate changes to documents in order to maintain referential integrity. Another constraint is character encoding. XML allows documents to be encoded using several different character sets. However, this specification mandates that all documents used with XCAP MUST be encoded using UTF-8. This cannot be changed by an application usage. The data validation information is consumed by both clients, which use them to make sure they construct requests that will be accepted by the server, and by servers, which validate the constraints when they receive a request (with the exception of referential integrity constraints, which are not validated by the server).5.4. Data Semantics For each application usage, the data present in the XML document has a well defined semantic. The application usage defines that semantic, so that a client can properly construct a document in order to achieve the desired result. They are not used by the server, as it is purposefully unaware of the semantics of the data it is managing. The data semantics are expressed in English prose by the application usage. One particularly important semantic is the base URI to be used for the resolution of any relative URI references pointed to XCAP resources. As discussed below, relative URI references pointing to XCAP resources cannot be resolved using the retrieval URI as the base URI. Therefore, it is up to the application usage to specify the base URI.5.5. Naming Conventions In addition to defining the meaning of the document in the context of a particular application, an application usage has to specify how the applications obtain the documents they need. In particular, it needsRosenberg Expires April 16, 2007 [Page 10] Internet-Draft XCAP October 2006 to define any well-known URIs used for bootstrapping purposes, and document any other conventions on the URIs used by an application. It should also document how documents reference each other. These conventions are called naming conventions. For many application usages, users need only a single document. In such a case, it is RECOMMENDED that the application usage require that this document be called

index

and exist within the users home directory. As an example, the RLS services application usage allows an RLS to obtain the contents of a resource list when the RLS receives a SUBSCRIBE request for a SIP URI identifying an RLS service. The application usage specifies that the list of service definitions is present within a specific document with a specific name within the global tree. This allows the RLS to perform a single XCAP request to fetch the service definition for the service associated with the SIP URI in a SUBSCRIBE request. Naming conventions are used by XCAP clients to construct their URIs. The XCAP server does not make use of them.5.6. Resource Interdependencies When a user modifies an XCAP resource, the content of many other resources is affected. For example, when a user deletes an XML element within a document, it does so by issuing a DELETE request against the URI for the element resource. However, deleting this element also deletes all child elements and their attributes, each of which is also an XCAP resource. As such, manipulation of one resource affects the state of other resources. For the most part, these interdependencies are fully specified by the XML schema used by the application usage. However, in some application usages, there is a need for the server to relate resources together, and such a relationship cannot be specified through a schema. This occurs when changes in one document will affect another document. Typically, this is the case when an application usage is defining a document that acts as a collection of information defined in other documents. As an example, when a user creates a new RLS service (that is, it creates a new

service

element within an RLS services document), the server adds that element to a read-only global list of services maintained by the server in the global tree. This read-only global list is accessed by the RLS when processing a SIP SUBSCRIBE request. Resource interdependencies are used by both XCAP clients and servers.Rosenberg Expires April 16, 2007 [Page 11] Internet-Draft XCAP October 20065.7. Authorization Policies By default, each user is able to access (read, modify, and delete) all of the documents below their home directory, and any user is able to read documents within the global directory. However, only trusted users, explicitly provisioned into the server, can modify global documents. The application usage can specify a different authorization policy that applies to all documents associated with that application usage. An application usage can also specify whether another application usage is used to define the authorization policies. An application usage for setting authorization policies can also be defined subsequent to the definition of the the main application usage. In such a case, the main application usage needs only to specify that such a usage will be defined in the future. If an application usage does not wish to change the default authorization policy, it can merely state that the default policy is used. The authorization policies defined by the application usage are used by the XCAP server during its operation.5.8. Data Extensibility An XCAP server MUST understand an application usage in order to process an HTTP request made against a resource for that particular application usage. However, it is not required for the server to understand all of the contents of a document used by an application usage. A server is required to understand the baseline schema defined by the application usage. However, those schemas can define points of extensibility where new content can be added from other namespaces and corresponding schemas. Sometimes, the server will understand those namespaces and therefore have access to their schemas. Sometimes, it will not. A server MUST allow for documents that contain elements from namespaces not known to the server. In such a case, the server cannot validate that such content is schema compliant; it will only verify that the XML is well-formed. If a client wants to verify that a server supports a particular namespace before operating on a resource, it can query the server for its capabilities using the XCAP Capabilities application usage, discussed in Section 12.Rosenberg Expires April 16, 2007 [Page 12] Internet-Draft XCAP October 20065.9. Documenting Application Usages Application usages are documented in specifications which convey the information described above. In particular, an application usage specification MUST provide the following information: o Application Unique ID (AUID): If the application usage is meant for general use on the Internet, the application usage MUST register the AUID into the IETF tree using the IANA procedures defined in Section 15. o XML Schema o Default Document Namespace o MIME Type o Validation Constraints o Data Semantics o Naming Conventions o Resource Interdependencies o Authorization Policies5.10. Guidelines for Creating Application Usages The primary design task when creating a new application usage is to define the schema. Although XCAP can be used with any XML document, intelligent schema design will improve the efficiency and utility of the document when it is manipulated with XCAP. XCAP provides three fundamental ways to select elements amongst a set of siblings – by the expanded name of the element, by its position, or by the value of a specific attribute. Positional selection always allows a client to get exactly what it wants. However, it requires a client to cache a copy of the document in order to construct the predicate. Furthermore, if a client performs a PUT, it requires the client to reconstruct the PUT processing that a server would follow in order to update its local cached copy. Otherwise, the client will be forced to re-GET the document after every PUT, which is inefficient. As such, it is a good idea to design schemas such that common operations can be performed without requiring the client to cache a copy of the document. Without positional selection, a client can pick the element at eachRosenberg Expires April 16, 2007 [Page 13] Internet-Draft XCAP October 2006 step by its expanded name or the value of an attribute. Many schemas include elements that can be repeated within a parent (often, minOccurs equals zero or one, and maxOccurs is unbounded). As such, all of the elements have the same name. This leaves the attribute value as the only way to select an element. Because of this, if an application usage expects user to manipulate elements or attributes that are descendants of an element which can repeat, that element SHOULD include, in its schema, an attribute which can be suitably used as a unique index. Furthermore, the naming conventions defined by that application usage SHOULD specify this uniqueness constraint explicitly. URIs often make a good choice for such unique index. They have fundamental uniqueness properties, and are also usually of semantic significance in the application usage. However, care must be taken when using a URI as an attribute value. URI equality is usually complex. However, attribute equality is performed by the server using XML rules, which are based on case sensitive string comparison. Thus, XCAP will match URIs based on lexical equality, not functional equality. In such cases, an application usage SHOULD consider these implications carefully. XCAP provides the ability of a client to operate on a single element, attribute or document at a time. As a result, it may be possible that common operations the client might perform will require a sequence of multiple requests. This is inefficient, and introduces the possibility of failure conditions when another client modifies the document in the middle of a sequence. In such a case, the client will be forced to detect this case using entity tags (discussed below in Section 7.11), and undo its previous changes. This is very difficult. As a result, the schemas SHOULD be defined so that common operations generally require a single request to perform. Consider an example. Lets say an application usage is defining permissions for users to perform certain operations. The schema can be designed in two ways. The top level of the tree can identify users, and within each user, there can be the permissions associated with the user. In an alternative design, the top level of the tree identifies each permission, and within that permission, the set of users who have it. If, in this application usage, it is common to change the permission for a user from one value to another, the former schema design is better for xcap; it will require a single PUT to make such a change. In the latter case, either the entire document needs to be replaced (which is a single operation), or two PUT operations need to occur – one to remove the user from the old permission, and one to add the user to the new permission.Rosenberg Expires April 16, 2007 [Page 14] Internet-Draft XCAP October 2006 Naming conventions form another key part of the design of an application usage. The application usage should be certain that XCAP clients know where to

start

to retrieve and modify documents of interest. Generally, this will involve the specification of a well- known document at a well-known URI. That document can contain references to other documents that the client needs to read or modify.6. URI Construction In order to manipulate an XCAP resource, the data must be represented by an HTTP URI. XCAP defines a specific naming convention for constructing these URIs. The URI is constructed by concatenating the XCAP root with the document selector with the node selector separator with a percent-encoded form of the node selector. This is followed by an optional query component that defines namespace bindings used in evaluating the URI. The XCAP root is the enclosing context in which all XCAP resources live. The document selector is a path that identifies a document within the XCAP root. The node selector separator is a path segment with a value of double tilde (

~~

), and SHOULD NOT be percent-encoded, as advised in Section 2.3 of RFC 3986 [13]. URIs containing %7E%7E should be normalized to ~~ for comparison; they are equivalent. The node selector separator is piece of syntactic sugar that separates the document selector from the node selector. The node selector is an expression that identifies a component of the document, such as an element or attribute. The sections below describe these components in more detail.6.1. XCAP Root The root of the XCAP hierarchy is called the XCAP root. It defines the context in which all other resources exist. The XCAP root is represented with an HTTP URI, called the XCAP Root URI. This URI is a valid HTTP URI; however, it doesn

t point to any resource that actually exists on the server. Its purpose is to identify the root of the tree within the domain where all XCAP documents are stored. It can be any valid HTTP URI, but MUST NOT contain a query component (a complete XCAP URI may have a query component, but it is not part of the XCAP root URI). It is RECOMMENDED that it be equal to xcap.domain where domain is the domain of the provider. As an example,

http://xcap.example.com

might be used as the XCAP root URI within the example.com domain. Typically, the XCAP root URI is provisioned into client devices. If not explicitly provisioned, clients SHOULD assume the form xcap.domain where domain is the domain of their service provider (for SIP, this would be the domain part ofRosenberg Expires April 16, 2007 [Page 15] Internet-Draft XCAP October 2006 their Address-of-Record (AOR)). A server or domain MAY support multiple XCAP root URIs. In such a case, it is effectively operating as if it were serving separate domains. There is never information carryover or interactions between resources in different XCAP root URIs. When a client generates an HTTP request to a URI identifying an XCAP resource, RFC 2616 procedures for the construction of the Request-URI apply. In particular, the authority component of the URI may not be present in the Request-URI if the request is sent directly to the origin server. The XCAP root URI can also be a relative HTTP URI. It is the responsibility of the application usage to specify the base URI for an HTTP URI representing an XCAP resource whenever such a URI appears within a document defined by that application usage. Generally speaking, it is unsafe to use the retrieval URI as the base URI. This is because any URI that points to an ancestor for a particular element or attribute can contain content including that element or attribute. If that element or attribute contained a relative URI reference, it would be resolved relative to whatever happened to be used to retrieve the content, and this will often not be the base URI defined by the application usage.6.2. Document Selector Each document within the XCAP root is identified by its document selector. The document selector is a sequence of path segments, separated by a slash (

/

). These path segments define a hierarchical structure for organizing documents within any XCAP root. The first path segment MUST be the XCAP AUID. So, continuing the example above, all of the documents used by the resource lists application would be under

http://xcap.example.com/resource-lists

. Implementors making use of HTTP servlets should be aware that XCAP may require them to get authorization from the server administrator to place resources within this specific subset of the URI namespace. It is assumed that each application will have data that is set by users, and/or it will have global data that applies to all users. As a result, beneath each AUID there are two sub-trees. One, called

users

, holds the documents that are applicable to specific users, and the other, called

global

, holds documents applicable to all users. The subtree beneath

global

is called the global tree. The path segment after the AUID MUST either be

global

or

users

. Within the

users

tree are zero or more sub-trees, each of whichRosenberg Expires April 16, 2007 [Page 16] Internet-Draft XCAP October 2006 identifies documents that apply to a specific user. Each user known to the server is associated with a username, called the XCAP User Identifier (XUI). Typically, an endpoint is provisioned with the value of the XUI. For systems that support SIP applications, it is RECOMMENDED that the XUI be equal to the Address-of-Record (AOR) for the user (i.e., sip:joe@example.com). Since SIP endpoints generally know their AOR, they will also know their XUI. As a consequence, if no XUI is explicitly provisioned, a SIP UA SHOULD assume it is equal to their AOR. This XUI MUST be used as the path segment beneath the

users

segment. Since the SIP URI allows for characters which are not permitted in HTTP URI path segments (such as the

?

and

/

characters, which are permitted in the user part of the SIP URI), any such characters MUST be percent encoded. The subtree beneath an XUI for a particular user is called their home directory.

User

in this context should be interpreted loosely; a user might correspond to device, for example. XCAP does not itself define what it means for documents to

apply

to a user, beyond specification of a baseline authorization policy, described below in Section 8. Each application usage can specify additional authorization policies which depend on data used by the application itself. The remainder of the document selector (the path following

global

or the XUI) points to specific documents for that application usage. Subdirectories are permitted, but are NOT RECOMMENDED. XCAP provides no way to create sub-directories or to list their contents, thus limiting their utility. If subdirectories are used, there MUST not be a document in a directory with the same name as a sub-directory. The final path segment in the document selector identifies the actual document in the hierarchy. This is equivalent to a filename, except that XCAP does not require that its document resources be stored as files in a file system. However, the term

filename

is used to describe the final path segment in the document selector. In traditional filesystems, the filename would have a filename extension, such as

.xml

. There is nothing in this specification that requires or prevents such extensions from being used in the filename. In some cases, the application usage will specify a naming convention for documents, and those naming conventions may or may not specify a file extension. For example, in the RLS services application usage [22], documents in the user

s home directory with the filename

index

will be used by the server to compute the global index, which is also a document with the filename

index

. Barring specific guidelines in the application usage, if a user has a single document for a particular application usage, this SHOULD be called

index

.Rosenberg Expires April 16, 2007 [Page 17] Internet-Draft XCAP October 2006 When the naming conventions in an application usage do not constrain the filename conventions (or, more generally, the document selector), an application will know the filename (or more generally, the document selector) because it is included as a reference in a document which is at a well known location. As another example, within the index document defined by RLS services, the

service

element has a child element called

resource-list

whose content is a URI pointing to a resource list within the users home directory. As a result, if the user creates a new document, and then references that document from a well-known document (such as the index document above), it doesn

t matter whether the user includes an extension in the filename or not, as long as the user is consistent and maintains referential integrity. As an example, the path segment

/resource-lists/users/sip:joe@example.com/index

is a document selector. Concatenating the XCAP root URI with the document selector produces the HTTP URI

http://xcap.example.com/resource-lists/users/ sip:joe@example.com/index

. In this URI, the AUID is

resource- lists

, and the document is in the user tree with the XUI

sip:joe@example.com

with filename

index

.6.3. Node Selector The node selector specifies specific nodes of the XML document which are to be accessed. A node refers to an XML element, an attribute of an element, or a set of namespace bindings. The node selector is an expression which identifies an element, attribute or set of namespace bindings. Its grammar is: node-selector = element-selector [

/

terminal-selector] terminal-selector = attribute-selector / namespace-selector / extension-selector element-selector = step *(

/

step) step = by-name / by-pos / by-attr / by-pos-attr / extension-selector by-name = NameorAny by-pos = NameorAny

[

position

]

position = 1*DIGIT attr-test =

@

att-name

=

att-value by-attr = NameorAny

[

attr-test

]

by-pos-attr = NameorAny

[

position

]

[

attr-test

]

NameorAny = QName /

*

; QName from XML Namespaces att-name = QName att-value = AttValue ; from XML specification attribute-selector =

@

att-nameRosenberg Expires April 16, 2007 [Page 18] Internet-Draft XCAP October 2006 namespace-selector =

namespace::*

extension-selector = 1*( %x00-2e / %x30-ff ) ; anything but

/

The QName grammar is defined in the XML namespaces [3] specification, and the AttValue grammar is defined in the XML specification XML 1.0 [1]. The extension-selector is included for purposes of extensibility. It can be composed of any character except the slash, which is the delimeter amongst steps. Any characters in an extension that cannot be represented in a URI MUST be percent-encoded before placement into a URI. Note that the double quote, left square bracket and right square bracket characters, which are meaningful to XCAP, cannot be directly represented in the HTTP URI. As a result, they are percent-encoded when placed within the HTTP URI. In addition to these characters, an apostrophe (

) character can be used as a delimiter within XPath expressions. Furthermore, since XML allows for non-ASCII characters, the names of elements and attributes may not be directly representable in a URI. Any such characters MUST be represented by converting them to an octet sequence corresponding to their representation in UTF-8, and then percent-encoding that sequence of octets. Similarly, the XML specification defines the QName production for the grammar for element and attribute names, and the AttValue production for the attribute values. Unfortunately, the characters permitted by these productions include some that are not allowed for pchar, which is the production for the allowed set of characters in path segments in the URI. The AttValue production allows many such characters within the US-ASCII set, including the space. Those characters MUST be percent- encoded when placed in the URI. Furthermore, QName and AttValue allow many Unicode characters, outside of US-ASCII. When these characters need to be represented in the HTTP URI, they are percent- encoded. To do this, the data should be encoded first as octets according to the UTF-8 character encoding [18] and then only those octets that do not correspond to characters in the pchar set should be percent-encoded. For example, the character A would be represented as

A

, the character LATIN CAPITAL LETTER A WITH GRAVE would be represented as

%C3%80

, and the character KATAKANA LETTER A would be represented as

%E3%82%A2

. As a result, the grammar above represents the expressions processed by the XCAP server internally after it has decoded the URI. The on- the-wire format is dictated by RFC 3986 [13]. In the discussions and examples below, when the node selectors are not part of an HTTP URI, they are presented in their internal format prior to encoding. If anRosenberg Expires April 16, 2007 [Page 19] Internet-Draft XCAP October 2006 example includes a node selector within an HTTP URI, it is presented in its percent-encoded form. The node selector is based on the concepts in XPath [10]. Indeed, the node selector expression, before it is percent-encoded for representation in the HTTP URI, happens to be a valid XPath expression. However, XPath provides a set of functionality far richer than is needed here, and its breadth would introduce much unneeded complexity into XCAP. To determine the XML element, attribute or namespace bindings selected by the node selector, processing begins at the root node of the XML document. The first step in the element selector is then taken. Each step chooses a single XML element within the current document context. The document context is the point within the XML document from which a specific step is evaluated. The document context begins at the root node of the document. When a step determines an element within that context, that element becomes the new context for evaluation of the next step. Each step can select an element by its name (expanded), by a combination of name and attribute value, by name and position, or by name, position and attribute. In all cases, the name can be wildcarded, so that all elements get selected. The selection operation operates as follows. Within the current document context, the children of that context are enumerated in document order. If the context is the root node of the document, its child element is the root element of the document. If the context is an element, its children are all of the children of that element (naturally). Next, those elements whose name is not a match for NameorAny are discarded. An element name is a match if NameorAny is the wildcard, or, if its not a wildcard, the element name matches NameorAny. Matching is discussed below. The result is an ordered list of elements. The elements in the list are further filtered by the predicates, which are the expressions in square brackets following NameorAny. Each predicate further prunes the elements from the current ordered list. These predicates are evaluated in order. If the content of the predicate is a position, the position-th element is selected (that is, treat

position

as a variable, and take the element whose position equals that variable), and all others are discarded. If there are fewer elements in the list than the value of position, the result is a no-match. If the content of the predicate is an attribute name and value, all elements possessing that attribute with that value are selected, and all others are discarded. Note that, although a document can haveRosenberg Expires April 16, 2007 [Page 20] Internet-Draft XCAP October 2006 namespace declarations within elements, those elements cannot be selected using a namespace declaration as a predicate. That is, a step like

el-name[@xmlns=

namespace

]

will never match an element, even if there is an element in the list that specifies a default namespace of

namespace

. In other words, a namespace node is NOT an attribute. If the namespaces in scope for an element are needed, they can be selected using the namespace-selector described below. If there are no elements with attributes having the given name and value, the result is a no-match. After the predicates have been applied, the result will be a no- match, one element, or multiple elements. If the result is multiple elements, the node selector is invalid. Each step in a node selector MUST produce a single element to form the context for the next step. This is more restrictive than general XPath expressions, which allow a context to contain multiple nodes. If the result is a no-match, the node selector is invalid. The node selector is only valid if a single element was selected. This element becomes the context for the evaluation of the next step in the node selector expression. The last location step is either the previously described element selector or a

terminal selector

. If the terminal selector is an attribute selector, the server checks to see if there is an attribute with the same expanded name in the current element context. If there is not, the result is considered a no-match. Otherwise, that attribute is selected. If the terminal selector is a namespace selector, the result is equal to the set of namespace bindings in scope for the element, including the possible default namespace declaration. This specification defines a syntax for representing namespace bindings, so they can be returned to the client in an HTTP response. As a result, once the entire node selector is evaluated against the document, the result will either be a no-match, invalid, a single element, a single attribute or a set of namespace bindings. Matching of element names is performed as follows. The element being compared in the step has its name expanded as described in XML namespaces [3]. The element name in the step is also expanded. This expansion requires that any namespace prefix is converted to its namespace URI. Doing that requires a set of bindings from prefixes to namespace URIs. This set of bindings is obtained from the query component of the URI (see Section 6.4). If the prefix of the QName of an element is empty, the corresponding URI is then the default document namespace URI defined by the application usage, or null if not defined. Comparisons are then performed as described in XML namespaces [3]. Note that the namespace prefix expansions described here are different than those specified in the XPath 1.0Rosenberg Expires April 16, 2007 [Page 21] Internet-Draft XCAP October 2006 specification, but are closer to those currently defined by the XPath 2.0 specification [24]. Matching of attribute names proceeds in a similar way. The attribute in the document has its name expanded as described in XML namespaces [3]. If the attribute name in the attribute selector has a namespace prefix, its name is expanded using the namespace bindings obtained from the query component of the URI. An unprefixed attribute QName is in no namespace. Comments, text content (including whitespace), and processing instructions can be present in a document, but cannot be selected by the expressions defined here. Of course, if such information is present in a document, and a user selects an XML element enclosing that data, that information would be included in a resulting GET, for example. Furthermore, whitespace is respected by XCAP. If a client PUTs an element or document that contains whitespace, the server retains that whitespace, and will return the element or document back to the client with exactly the same whitespace. Similarly, when an element is inserted, no additional whitespace is added around the inserted element, and the element gets inserted in a very specific location relative to any whitespace, comments or processing instructions around it. Section 8.2.3 describes where the insertion occurs. As an example, consider the following XML document:

?xml version=

1.0

?

watcherinfo xmlns=

urn:ietf:params:xml:ns:watcherinfo

version=

0

state=

full

watcher-list resource=

sip:professor@example.net

package=

presence

watcher status=

active

id=

8ajksjda7s

duration-subscribed=

509

event=

approved

sip:userA@example.net

/watcher

watcher status=

pending

id=

hh8juja87s997-ass7

display-name=

Mr. Subscriber

event=

subscribe

sip:userB@example.org

/watcher

/watcher-list

/watcherinfo

Figure 3: Example XML Document Assuming that the default document namespace for this application usage is

urn:ietf:params:xml:ns:watcherinfo

, the node selectorRosenberg Expires April 16, 2007 [Page 22] Internet-Draft XCAP October 2006 watcherinfo/watcher-list/watcher[@id=

8ajksjda7s

] would select the following XML element:

watcher status=

active

id=

8ajksjda7s

duration-subscribed=

509

event=

approved

sip:userA@example.net

/watcher

6.4. Namespace Bindings for the Selector In order to expand the namespace prefixes used in the node selector, a set of bindings from those namespace prefixes to namespace URI must be used. Those bindings are contained in the query component of the URI. If no query component is present, it means that only the default document namespace (as identified by the application usage) is defined. The query component is formatted as a valid xpointer expression [5] after suitable URI encoding as defined in Section 4.1 of the Xpointer framework. This xpointer expression SHOULD only contain expressions from the xmlns() scheme [4]. A server compliant to this specification MUST ignore any xpointer expressions not from the xmlns() scheme. The xmlns() xpointer expressions define the set of namespace bindings in use for evaluating the URI. Note that xpointer expressions were originally designed for usage within fragment identifiers of URIs. However, within XCAP, they are used within query components of URIs. The following example shows a more complex matching operation, this time including the usage of namespace bindings. Consider the following document:

?xml version=

1.0

?

foo xmlns=

urn:test:default-namespace

ns1:bar xmlns:ns1=

urn:test:namespace1-uri

xmlns=

urn:test:namespace1-uri

baz/

ns2:baz xmlns:ns2=

urn:test:namespace2-uri

/

/ns1:bar

ns3:hi xmlns:ns3=

urn:test:namespace3-uri

there/

/ns3:hi

/foo

Assume that this document has a document URI of

http://xcap.example.com/test/users/sip:joe@example.com/index

, where

test

is the application usage. This application usage defines aRosenberg Expires April 16, 2007 [Page 23] Internet-Draft XCAP October 2006 default document namespace of

urn:test:default-namespace

. The XCAP URI: http://xcap.example.com/test/users/sip:joe@example.com/index/ ~~/foo/a:bar/b:baz?xmlns(a=urn:test:namespace1-uri) xmlns(b=urn:test:namespace1-uri) will select the first

baz

child element of the

bar

element in the document. The XCAP URI: http://xcap.example.com/test/users/sip:joe@example.com/index/ ~~/foo/a:bar/b:baz?xmlns(a=urn:test:namespace1-uri) xmlns(b=urn:test:namespace2-uri) will select the second

baz

child element of the

bar

element in the document. The following XCAP URI will also select the second element in the document: http://xcap.example.com/test/users/sip:joe@example.com/index/ ~~/d:foo/a:bar/b:baz?xmlns(a=urn:test:namespace1-uri) xmlns(b=urn:test:namespace2-uri) xmlns(d=urn:test:def