組裝和解析xml字串

2021-08-20 07:40:44 字數 3609 閱讀 7135

組裝xml

<?xmlversion="1.0" encoding="utf-8"?>

'ecm_tech_doc』 system='program'>

c_project_code;c_record_code;c_attach_count;c_receive_date;c_is_checked

where c_record_codelike '%***%' and c_volume_labellike 『%***%』 and c_revisionlike 『%***%』

返回記錄數量

-->5其中

ecm_tech_doc

是工程檔案型別

c_record_code

為檔案編碼,

c_volume_label

為卷標,

c_revision

為版本public string buildxml(string crecordcode,string cvolumelabel,string crevision );

if(cvolumelabel==null);

if(crevision==null);

stringbuilder bu = new stringbuilder();

string param = bu.tostring();

system.out.println(param);

return param;

}2.解析xml

返回xml字串

<?xml version="1.0" encoding="utf-8"?>b1/1aa417ptr543dnhx45ddtrueaa2010-08-13 00:00:0009d69409801c2352

0pre

a1/1aa8n0815607cs3143sdtrueaa2010-08-23 00:00:0009d69409801c2354

0cfc

a1/1aa8n0815629cs3143sdtrueaa2010-08-23 00:00:0009d69409801c2366

0cfc

a1/1aa8n0815643cs3143sdtrueaa2010-08-23 00:00:0009d69409801c236a

0cfc

a1/1aa8n0815807cs3143sdtrueaa2010-08-23 00:00:0009d69409801c2371

0cfc

a1/1aa8n0815814cs3143sdtrueaa2010-08-23 00:00:0009d69409801c2376

0cfc

a1/1aa3w0115020a0e743sdtrueaa2010-08-13 00:00:0009d69409801c237b

0cfc

a31/1aa1l0116026a0e743sdfalseaa2010-06-07 00:00:0009d69409801c23d8

0vft

a11/1aa9ga083094a0e543sdfalseaa2012-03-05 00:00:0009d69409801c23d9

0vfp

a1/1aa3w0115023a0e743sdtrueaa2010-08-13 00:00:0009d69409801c23dc

0cfc

a1/1aa2r1216030cs3143sdtrueaa2010-06-22 00:00:0009d69409801c23dd

0cfc

a11/1aa9ga083100a0e543sdfalseaa2012-03-05 00:00:0009d69409801c23df

0vfp

b1/1aa1r5616000cs3143sdtrueaa2010-06-22 00:00:0009d69409801c23e4

0cfc

a11/1aa9ga083109a0e543sdfalseaa2012-03-05 00:00:0009d69409801c23e3

0vfp

b1/1aa1w0116999cs3143sdtrueaa2010-06-22 00:00:0009d69409801c23e8

0cfc

b1/1aa9n7216999cs3143sdtrueaa2010-06-22 00:00:0009d69409801c23ec

0cfc

a31/1aa2k0815043a0e743sdfalseaa2012-02-22 00:00:0009d69409801c23ed

0vfc

b1/1aa9n7216000cs3143sdtrueaa2010-06-22 00:00:0009d69409801c23f1

0cfc

a11/1aa9n7216784zn2343sdfalseaa2012-03-05 00:00:0009d69409801c23f2

0vfp

a1/1aa332804016s45f04gnfalseaa2012-02-16 00:00:0009d69409801c23f7

0cae

a1/1aa8n0816262a0e743sdtrueaa2010-06-30 00:00:0009d69409801c23f8

0cfc

a1/1aa8n0816268a0e743sdtrueaa2010-06-30 00:00:0009d69409801c23fd

0cfc

c1/1py899sbe001enff45gntruepy2011-12-30 00:00:0009d69409801c23fe

0cfc

a11/1aa9ga083113a0e543sdfalseaa2012-03-05 00:00:0009d69409801c23ff

0vfp

a1/1aa8n0816270a0e743sdtrueaa2010-06-30 00:00:0009d69409801c2401

0cfc

public dataobject par***ml(string result) throws documentexception ;//

卷標if ("c_volume_label".equals(name))

//版本

if ("c_revision".equals(name))

;if ("c_project_code".equals(name)) ;//

狀態if ("c_doc_status".equals(name)) ;//

主題if ("subject".equals(name))

;/*if ("c_attach_count".equals(name)) */

;// doc.g

}list.add(object);

}dataobject onj = new dataobject[list.size()];

for (int i = 0; i < onj.length; i++)

return onj;

}/**

* 讀取xml檔案並轉化為document物件

* @param file

* @return

* @throws documentexception

*/public static document readxmlfile(string xml) throws documentexception

生成和解析XML格式的字串

使用dom4j生成xml格式的字串 document document documenthelper.createdocument 建立msgbody element msgbody document.addelement msgbody 生成msgbody的乙個節點 element queryse...

xml檔案 字串解析

解析xml字串,如下 public static void main string args catch exception e 解析xml檔案,xml檔案如下 aaa 學校 13728704450 男,1958年出生 bbbyyy學校 1372sadgasg4450 男,1968年出生,出生地長沙...

dom解析xml字串

xmlstr 2 300240 3010 斜土路1 null null00 3010 1300240 rzrq 信用業務部 0null null00 rzrq 4300240 信用交易部 null 0null null10 xyjyb 3300240 3020 武寧路1 null null10 30...