现有XML文档数据如下:
<?xml version="1.0" encoding="GBK" ?>
- <ROOT>
- <CONFIG>
<TYPE>OUT</TYPE>
<WORKTYPE>1</WORKTYPE>
</CONFIG>
- <RESULT>
<UNITCODE>5020100</UNITCODE>
<APPLYNO>ASHZH1104410D922232J</APPLYNO>
<POLICYNO />
<APPLYENDORSENO />
<STATUS_AUDITSTATUS>02</STATUS_AUDITSTATUS>
<COMMENTS>提交成功!</COMMENTS>
</RESULT>
</ROOT>请问我用VB6.0如何得到每个节点之间的数据??如5020100
本人刚涉及VB。请各位多多指点!
<?xml version="1.0" encoding="GBK" ?>
- <ROOT>
- <CONFIG>
<TYPE>OUT</TYPE>
<WORKTYPE>1</WORKTYPE>
</CONFIG>
- <RESULT>
<UNITCODE>5020100</UNITCODE>
<APPLYNO>ASHZH1104410D922232J</APPLYNO>
<POLICYNO />
<APPLYENDORSENO />
<STATUS_AUDITSTATUS>02</STATUS_AUDITSTATUS>
<COMMENTS>提交成功!</COMMENTS>
</RESULT>
</ROOT>请问我用VB6.0如何得到每个节点之间的数据??如5020100
本人刚涉及VB。请各位多多指点!
解决方案 »
- 16*16繁体点阵字库
- 急,关于shellExecute函数的问题
- winsock问题!用的是udp协议!各位大哥救我啊!
- 哪个api可以设置一个窗体为另一个的所有者(也就是show方法的ownerform参数效果)?
- ADO连接文本文件的问题,很简单,快来抢分阿!
- *******这样写对吗?******
- 怎么样多次使用form1.printform方法呀?100分送上!
- 如何将数字型化成时间型
- ###高手请进,有高分###
- 各位大虾救命,急死我了,我非常痛苦,急,急,急!!!!!!!!!!!!!!!!!
- COM组件注册与加载的问题
- 100分求利用API函数BeginPath等方法画一个由两点直线和圆弧组成的多边形
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "comdlg32.ocx"
Begin VB.Form XMLParse
BorderStyle = 1 'Fixed Single
Caption = "XMLParse"
ClientHeight = 4050
ClientLeft = 45
ClientTop = 330
ClientWidth = 5880
BeginProperty Font
Name = "Arial Black"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4050
ScaleWidth = 5880
StartUpPosition = 3 'Windows Default
Begin VB.TextBox CodeText
Height = 2295
Left = 240
MultiLine = -1 'True
TabIndex = 3
Top = 840
Width = 5415
End
Begin VB.CommandButton Save
Caption = "Save"
BeginProperty Font
Name = "Arial"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 3360
TabIndex = 1
Top = 3480
Width = 975
End
Begin MSComDlg.CommonDialog CDialog
Left = 5280
Top = 0
_ExtentX = 847
_ExtentY = 847
_Version = 393216
Orientation = 2
End
Begin VB.CommandButton Generate
Caption = "Generate"
BeginProperty Font
Name = "Arial"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1200
TabIndex = 0
Top = 3480
Width = 975
End
Begin VB.Label XmlLableText
Caption = "XmlLableText"
BeginProperty Font
Name = "Arial"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 300
Left = 360
TabIndex = 2
Top = 360
Width = 5415
End
End
Attribute VB_Name = "XMLParse"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private oXMLDom As MSXML2.DOMDocument
Private oXMLElement As MSXML2.IXMLDOMElement
Private oTemElement() As MSXML2.IXMLDOMElement
Private oNodeAttr As MSXML2.IXMLDOMAttribute
Private Sub Generate_Click() Dim oThisNode As MSXML2.IXMLDOMNode
'<--Create a new DOMDoc and then set the root element
Set oXMLDom = CreateObject("MSXML2.DOMDocument")
oXMLDom.async = False
oXMLDom.validateOnParse = False
Set oXMLElement = oXMLDom.createElement("Root")
Set oXMLDom.documentElement = oXMLElement'<--Create the child nodes and set the attributes(or values) if needed
ReDim oTemElement(0)
Set oTemElement(0) = oXMLDom.createElement("Node")
oXMLElement.appendChild oTemElement(0)
oTemElement(0).setAttribute "NodeAttr", "AttributeOfThisNode"'<--Using dynamic object array to create nodes(attribute node)
ReDim Preserve oTemElement(UBound(oTemElement) + 1)
Set oTemElement(UBound(oTemElement)) = oXMLDom.createElement("Code")
oTemElement(UBound(oTemElement) - 1).appendChild oTemElement(UBound(oTemElement)) Set oNodeAttr = oXMLDom.createAttribute("ChildNodeAttri")
oTemElement(UBound(oTemElement)).setAttributeNode oNodeAttr
oNodeAttr.Value = "ValueOfThisNodeAttr" oTemElement(UBound(oTemElement)).Text = "Value Of this Element Node"
Dim oCDATA As IXMLDOMCDATASection
Dim sText As String
'Here is the code can be from other place
If CodeText.Text <> "" Then
sText = CodeText.Text
Else
Set oXMLDom = Nothing
Exit Sub
End If
Set oCDATA = oXMLDom.createCDATASection(sText)
oTemElement(UBound(oTemElement)).appendChild oCDATA
MsgBox "Generated Successful, Save"
Save.Enabled = True End SubPrivate Sub Form_Load()
Save.Enabled = False
CodeText.Text = "Dim test : test=123 : Msgbox test"
XmlLableText.Caption = "A CASE OF GENERATING XML FILE USING DOM...."
End Sub
Private Sub Save_Click() On Error Resume Next
Dim sFilePath As String With CDialog
.FileName = ""
.MaxFileSize = 32767
.DialogTitle = "Save"
.Filter = "XML File(*.xml)|*.xml"
.FilterIndex = 1
.Flags = cdlOFNExplorer + cdlOFNOverwritePrompt
.CancelError = True
.Action = 2
sFilePath = .FileName
End With
If Err = cdlCancel Then
Exit Sub
End If
oXMLDom.Save (sFilePath)
Set oXMLDom = Nothing
XMLParse.Hide
XMLReadCode.Show
End Sub