我用了我們論壇里的:unoksoft_xmlparser的pbl生成了XML格式的內容檔案,現在我想用PB把他內容寫為*.xml檔案,請教高手。下面是我的代碼:
long i
string ls_storedate
string ls_ProName
string ls_DrNaCode
string ls_Producer
string ls_Supplier
string ls_prospeci
string ls_medform
string ls_approval
string ls_batchno
string ls_effdate
string ls_stocknum
string ls_drugunit
string ls_indate
string ls_druncode
string ls_dir
string ls_dirver
ls_storedate = string(today(),'yyyy-mm-dd')
unoksoft_XMLParser XMLroot,XMLdata
XMLroot = newXML('DailyIn','')
if isValid(XMLroot) then
XMLroot.xmlencoding = 'UTF-8'
//
unoksoft_XMLParser OwBuInf
OwBuInf = XMLroot.addelement('OwBuInf')
OwBuInf.addattribute('OwBuCode','360501')
//
unoksoft_XMLParser ComInfo
ComInfo = OwBuInf.addelement('ComInfo')
ComInfo.addattribute('ComCode','B05A19')
ComInfo.addattribute('TransNo','0IR5IFOUR0QK')
//
unoksoft_XMLParser InRecord
InRecord = ComInfo.addelement('InRecord')
InRecord.addattribute('StoreDate',''+ ls_storedate +'')
for i = 1 to dw_jxxsdkcjl.rowcount()
ls_Dir = '未'
ls_DirVer = ''
XMLdata.addattribute('Dir',''+ ls_Dir +'')
XMLdata.addattribute('DirVer',''+ ls_DirVer +'')
next
string ls_file
integer li_FileNum
ls_file = XMLroot.generatexml( true )
li_FileNum = FileOpen("e:\1.xml",LineMode!, Write!, LockWrite!, Replace!)
FileWrite(li_FileNum,ls_file)
FileClose(li_FileNum)
destroy XMLroot
else
gf_messagebox(2,'創建XML檔案失敗!')
end if
寫成了1.xml檔案,但是IE打開報錯。
uj5u.com熱心網友回復:
你看看XML檔案的內容有沒有問題,還有就是filewrite寫檔案時是否寫完整了。uj5u.com熱心網友回復:
無法顯示 XML 頁。使用 XSL 樣式表無法查看 XML 輸入。請更正錯誤然后單擊 重繪按鈕,或以后重試。
--------------------------------------------------------------------------------
文本內容中發現無效字符。處理資源 'file:///E:/mytest.xml' 時出錯。第 3 行,位置: 39
<OwBuInf OwBuCode="360501" OwBuCode="
uj5u.com熱心網友回復:
是漢字的問題,想請教有誰用過這個用戶物件,可以解決漢字的問題嗎?轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/81561.html
標籤:腳本語言
上一篇:怎樣生成xml?
