2008年8月13日星期三

XML操作中读取一个节点的所有参数并传递到数组

第一次写,不知道传递到数组还是直接用OBJECT更好

Private Function GetNodeValue(ByVal start_at_node As IXMLDOMNode, _
ByVal node_name As String, _
Optional ByVal default_value As String = "") As String
Dim value_node As IXMLDOMNodeList

Set value_node = start_at_node.selectNodes(".//" & node_name)
If value_node Is Nothing Then
GetNodeValue = default_value
Else
For i = 0 To (value_node.length - 1)
GetNodeValue = GetNodeValue + value_node.Item(i).Text + "|"
Next i
End If
End Function

没有评论: