ASP常用函数收藏乱七八糟未整理版(77)
If TypeName(oNode) = "Nothing" or TypeName(oNode) = "Null" or TypeName(oNode) = "Empty" Then
GetXMLNodeValue = sDefValue
Set oNode = Nothing
Else
GetXMLNodeValue = Trim(oNode.Text)
Set oNode = Nothing
End If
End Function
'===================================================================================
' 函数原型:GetXMLNodeAttribute(ByRef xmlDom,sFilter,sName,sDefValue)
'功能:从一个XML文档中查找指定节点的指定属性
'参数:xmlDomXML文档
'sFilterXPATH定位字符串
'sName要查询的属性名称
'sDefValue默认值
'返 回 值:无
'涉及的表:无
'===================================================================================
Public Function GetXMLNodeAttribute(ByRef xmlDom, sFilter, sName, sDefValue)
Dim oNode
Set oNode = xmlDom.selectSingleNode(sFilter)
If TypeName(oNode) = "Nothing" or TypeName(oNode) = "Null" or TypeName(oNode) = "Empty" Then
GetXMLNodeAttribute = sDefValue
Set oNode = Nothing
Else
Dim pTemp
Set pTemp = oNode.getAttribute(sName)
If TypeName(pTemp) = "Nothing" or TypeName(pTemp) = "Null" or TypeName(pTemp) = "Empty" Then
GetXMLNodeAttribute = sDefValue
Set oNode = Nothing
Set pTemp = Nothing
Else
GetXMLNodeAttribute = Trim(pTemp.Value)
Set oNode = Nothing
Set pTemp = Nothing
End If
End If
End Function
'===================================================================================
内容版权声明:除非注明,否则皆为本站原创文章。