使用pbdom创建xml文档,需要得到对应xml文档的xml字符串保存到数据库中,可是
pbdom_document只提供了savedocument保存成xml文件,怎么转换成对应的xml字符串,救命啊!
------解决方案--------------------
我不赞成用PBDOM,因PB11.NET不支持,XML的一些功能可以自已写个helper class(NVO).
------解决方案--------------------
如果xml结构是二维的话(就是能跟数据库行列相互对应),为datawindow对象设置一个xml模板,然后import()一下就行了
------解决方案--------------------
用xmldom,在pb中通过com连接后操作
------解决方案--------------------
xuexi
------解决方案--------------------
pbdom_document ldc_doc
pbdom_builder lbu_lbuilder
pbdom_element pbdom_elem
PBDOM_Element pbdom_child_a[]
string ls_xml
if FileExists(AXMLFile) then
lbu_lbuilder = Create PBDOM_Builder
ls_xml = gf_get_filetext(AXMLFile)
ldc_doc = lbu_lbuilder.buildfromstring(ls_xml)
//ldc_doc = lbu_lbuilder.buildfromfile(AXMLFile)
destroy lbu_lbuilder
end if
//验证文档是否有效
pbdom_elem = ldc_doc.getrootelement()
try
pbdom_elem.GetChildElements(pbdom_child_a)
catch(RuntimeError rte)
setnull(ldc_doc)
end try
//
gf_get_filetext(filename)
string ls_xml
if not fileexists(filename) then return ls_xml
integer li_FileNum
string ls_Emp_Input
string lblob
long ll_FLength,loops,I
ll_FLength = FileLength(filename)
li_FileNum = FileOpen(filename, StreamMode!)
IF ll_FLength > 32765 THEN
IF Mod(ll_FLength, 32765) = 0 THEN
loops = ll_FLength/32765
ELSE
loops = (ll_FLength/32765) + 1
END IF
ELSE
loops = 1
END IF
FOR i = 1 to loops
FileRead(li_FileNum, lblob)
ls_xml = ls_xml + lblob
NEXT
FileClose(li_FileNum)
return ls_xml
ls_xml 为得到的串!
------解决方案--------------------
帮你顶一下