#1 PB截取XML内容
P
B
E
x
p
o
r
t
H
e
a
d
e
r
PBExportHeader
PBExportHeaderf_split_xml.srf
global type f_split_xml from function_object
end type
forward prototypes
global function long f_split_xml (string as_source, string as_split, ref string as_ret[])
end prototypes
global function long f_split_xml (string as_source, string as_split, ref string as_ret[]);//分解XML到数组
Long ll_count
Long ll_pos_h,ll_pos_e
String ls_xml
String ls_xml_b,ls_xml_e
String ls_value
//f_split_xml(lsOut,‘memberNO’,memberNO[])
ls_xml = as_source
ls_xml_b = ‘<’+as_split+’>’
ls_xml_e = ‘</’+as_split+’>’
ll_pos_h = PosA(ls_xml,ls_xml_b,1)
ll_pos_e = PosA(ls_xml,ls_xml_e,1)
ll_count = 0
Do While ll_pos_h > 0
ll_count ++
ls_value = ''
ls_value = MidA(ls_xml,ll_pos_h + LenA(ls_xml_b) ,ll_pos_e - ll_pos_h - LenA(ls_xml_b))
If Isnull(ls_value) Then ls_value = ''
as_ret[ll_count] = ls_value
ls_xml = MidA(ls_xml,ll_pos_e + LenA(ls_xml_e))
ll_pos_h = PosA(ls_xml,ls_xml_b,1)
ll_pos_e = PosA(ls_xml,ls_xml_e,1)
Loop
If ll_count <= 0 Then as_ret[1] = ‘-1’
Return ll_count
end function