posts - 35,  comments - 6,  trackbacks - 0

      刚开始学习xmlBean觉得非常好用,所以边学习,边开始整理一些应用,供留备.
      在xmlbeans2.2\samples\OrderMatters有很多例子,我就是参照学习的^-^;
      

1,创建ServicesDocument

 1 public static ServicesDocument parseXml(String filePath) throws Exception {
 2         File file = new File(filePath);
 3         ServicesDocument sd = null;
 4         if (file.exists()) {
 5             try {
 6                 sd = ServicesDocument.Factory.parse(file);
 7             } catch (Exception e) {
 8                 throw new Exception(e.toString());
 9             }
10         }
11         else{
12             sd = createServicesDocument();
13         }
14         return sd;
15     }
16 

2,应用ServicesDocument可以取得你定义的xml对象节点进行操作
     1)当你在xsd中定义了节点为maxOccurs="unbounded"时

 1 Workflow[] wfs = ses.getWorkflowArray();
 2         String pacId = workflow.getPackageDefId();
 3         String proDefId = workflow.getProcessDefId();
 4         String actDefID = workflow.getActivityDefId();
 5         for (int i = 0; i < wfs.length; i++) {
 6             Workflow existWorkflow = wfs[i];
 7             if (pacId.equals(existWorkflow.getPackageDefId())
 8                     && proDefId.equals(existWorkflow.getProcessDefId())
 9                     && actDefID.equals(existWorkflow.getActivityDefId())) {
10                 ses.removeWorkflow(i);
11                 break;
12             }
13         }


posted on 2007-04-28 07:57 NG 阅读(163) 评论(0)  编辑  收藏

只有注册用户登录后才能发表评论。


网站导航:
 
<2007年4月>
25262728293031
1234567
891011121314
15161718192021
22232425262728
293012345

常用链接

留言簿(1)

随笔档案(35)

文章分类(5)

文章档案(2)

新闻档案(5)

java link

搜索

  •  

最新评论

阅读排行榜

评论排行榜