[vb6.0/vba] Web Browser(Internet Explorer) html Document xPath > vb6.0/vba

본문 바로가기

vb6.0/vba

[vb6.0/vba] [vb6.0/vba] Web Browser(Internet Explorer) html Document xPath

익명
2020-09-29 08:37 1,013 1

본문

Public Function getXPathElement(sXPath As String, objElement As ObjectAs Object
    On Error GoTo ErrPass
    Dim sXPathArray() As String
    Dim sNodeName As String, sNodeNameIndex As String
    Dim sRestOfXPath As String
    Dim lNodeIndex As Long, lCount As Long
    sXPathArray = Split(sXPath, "/")
    sNodeNameIndex = sXPathArray(1)
    If Not InStr(sNodeNameIndex, "["> 0 Then
        sNodeName = sNodeNameIndex
        lNodeIndex = 1
    Else
        sXPathArray = Split(sNodeNameIndex, "[")
        sNodeName = sXPathArray(0)
        lNodeIndex = CLng(Left(sXPathArray(1), Len(sXPathArray(1)) - 1))
    End If
    sRestOfXPath = Right(sXPath, Len(sXPath) - (Len(sNodeNameIndex) + 1))
    Set getXPathElement = Nothing
    For lCount = 0 To objElement.ChildNodes().Length - 1
        If UCase(objElement.ChildNodes().Item(lCount).nodeName) = UCase(sNodeName) Then
            If lNodeIndex = 1 Then
                If sRestOfXPath = "" Then
                    Set getXPathElement = objElement.ChildNodes().Item(lCount)
                Else
                    Set getXPathElement = getXPathElement(sRestOfXPath, objElement.ChildNodes().Item(lCount))
                End If
            End If
            lNodeIndex = lNodeIndex - 1
        End If
    Next lCount
ErrPass:
End Function




댓글목록1

익명글님의 댓글

익명
2020-09-29 08:42
요소의 값들을 가져오는 방법!!
검증안됨 추후 필요시 검증 후 사용


HTML.getElementById("popup").Style.cssText
HTML.getElementById("popup").innerHTML

HTML.getElementById("popup").getAttribute("style")
HTML.getElementById("popup").getAttribute("style").cssText
HTML.getElementById("popup").getAttribute("style",0)
HTML.getElementById("popup").getAttribute("style",0).cssText
HTML.getElementById("popup").Style.Visibility
게시판 전체검색