PB 截取XML内容

#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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值