代码记录
Module m //定义模块
Object o //定义对象Item i //定义项int objCount //定义计数string itemType //定义相类型string modName, fullModName//定义模块名字,模块全名(路径名)string objectnumber[1000]={null}//定义需求编号string objectheading[1000]={null}//定义需求标题数组string objecturl[1000]={null}//定义需求链接数组string objecttext[1000]={null}//定义需求内容数组string e //定义对象总数int k //用于循环计数Project p //定义项目变量用于文件名存储项目名称for i in current Project do //Loops through each undeleted and visible item //循环当前项目
{ p = current Project //定义变量等于当前项目 itemType = type i //项目类型=项的类型 if( itemType == "Formal") //如果项的类型是Formal,DOORS中模块属性为Formal Module { fullModName = fullName(i)//存储为模块的项目的全名 modName = name(i)//存储模块名 m = read(fullModName,false)//读取路径模块 objCount=0 //计需求数 for o in m do { //Loops through each undeleted and visible object //循环模块 objectnumber[objCount]=number(o) //存储需求编号 objectheading[objCount]= o."Object Heading"//存储需求标题 objecturl[objCount]=getURL(o)//存储需求url objecttext[objCount]= o."Object Text"//存储需求内容 if(objectheading[objCount]==null)//倘若需求标题为空,存储null { objectheading[objCount]="null" } if(objecttext[objCount]==null)//倘若需求内容为空,存储null { objecttext[objCount]="null" } objCount++ //数量++ e = identifier o //e为当前需求对象的identifier,对象的identifier与number不同,为1,2和1,1.1的区别。}
string savefile ="\\\\WEIXINYUAN\\Users\\wxy\\"name p "&" m."Name" ".xml"//存储到共享目录,此处应注意windows系统下的路径以\\分割,网络路径本身以\\开始,所以前面再加\\ Stream out = write (savefile,CP_UTF8) //定义写入文件,为UTF-8格式 out<<"<?xml version=""\"""1.0""\""" encoding=\"utf-8\"?>" //写入xml文件的头,注意文法问题 out<<"\n"
out<<"<all>" //标签
out<<"\n"out<<"<objectcount>"
out<<e //写入需求对象的总数 out<<"</objectcount>" out<<"\n"out<<"<modulepath>"
out<<fullModName //写入模块路径 out<<"</modulepath>" out<<"\n" for(k=0;k<objCount;k++) //循环写入数组中的所有需求内容 { out<<"<obj ID =" out<<objectnumber[k] //写入需求的ID标签 out<<">" out<<"\n" out<<"<objheading>" out<<objectheading[k] //写入需求的标题 out<<"</objheading>" out<<"\n"out<<"<objurl>"
out<<objecturl[k] //写入需求的url out<<";" out<<"</objurl>" out<<"\n"out<<"<objtext>"
out<<objecttext[k] //写入需求的内容 out<<"</objtext>" out<<"\n"out<<"</obj>"
out<<"\n" } out<<"</all>" close(m) //关闭当前的模块 }}
//结束