1。我的XML文件使用GB2312编码,我已将其修改为UTF-8。 2.修改完XML节点属性后,嵌入节点属性中的VB片段完全混乱,导致VB无法正常工作
我已经尝试将其读取并保存为UTF-8编码
<?xml version="1.0" encoding="GB2312" ?>
<ztpage rect="0,0,8000,800" layer="1073741823" version="2" mag="100,100" zoom="100,400" pagetitle="0EOCCSIGZCT" refreshrate="1000" pagepos="0,100,3840,900" script='Sub page_OnLoad()
'page.SetPos 0,180,10000,800
'page.GetPos EOCCSIGZCT,a,b,c,d
'MsgBox a
'page.ZoomPan
page.EnableZoom = 2
page.ShowScrollBar = 1
page.ZoomStepPercent = 10
'
sys.WriteValue "$DJS", 0
'
<?xml version='1.0' encoding='GB2312'?>
<ztpage layer="1073741823" mag="100,100" pagepos="0,100,3840,900" pagetitle="0EOCCSIGZCT" rect="0,0,8000,800" refreshrate="1000" script="Sub page_OnLoad() 'page.SetPos 0,180,10000,800 'page.GetPos EOCCSIGZCT,a,b,c,d 'MsgBox a 'page.ZoomPan page.EnableZoom = 2 page.ShowScrollBar = 1 page.ZoomStepPercent = 10 sys.WriteValue "$DJS", 0 sys.WriteValue "$DCHXY", 1 sys.WriteValue "$WLQDXY",1 sys.WriteValue "$LJQDXY",1 sys.WriteValue "$LXHXY", 1 ' sys.WriteValue "$MDDMXY",1 ' sys.WriteValue "$LIECHEXIANSHI",1 sys.WriteValue "$beishu",1 'sys.WriteValue "$FWHXY", 0 End Sub Sub page_OnLButtonUp(lFlag, lPointX, lPointY) page.ZoomPan End Sub Dim a,c Sub Timer2_OnTimer() Dim b sys.ReadValue "OCC.AAA.F_CV",c If a<>c Then sys.ReadValue "OCC.AAA.F_CV",a sys.WriteValue "OCC.BBB.F_CV", a End If sys.ReadValue "OCC.BBB.F_CV",b b = b-1 If b>-1 Then sys.WriteValue "OCC.BBB.F_CV", b sys.WriteValue "$DJS",b End If End Sub
1。最初,为了方便起见,我想用Python解决它,如何保存XML格式呢?