• MSXML 4.0 SelectSingleNode (VB6 SP5)

    Author
    Topic
    #365172

    Has anyone had problems with this function ?
    I get a error 91 on the With node.ChildNodes line when I use it with a DOMDocument4.0, but if I go back to using a DOMDocument3.0 it works fine?

    Option Explicit

    Private Sub Command1_Click()

    Dim xmlDoc As New MSXML2.DOMDocument30
    ‘Dim xmlDoc As New MSXML2.DOMDocument40

    xmlDoc.async = False
    ‘xmlDoc.setProperty “SelectionLanguage”, “XPath”

    xmlDoc.Load (App.Path & “nlis.xml”)
    If xmlDoc.parsed = True Then
    Debug.Print “Loaded ” & App.Path & “nlis.xml”
    Else
    Debug.Print “Error ” & xmlDoc.parseError.reason
    End If

    If GetTestValues(xmlDoc) Then
    Debug.Print “got values”
    Else
    Debug.Print “problem”
    End If

    Set xmlDoc = Nothing

    End Sub

    ‘Public Function GetTestValues(pxmlReceive As MSXML2.DOMDocument40) As Boolean
    ‘Dim mpxmlReceive As MSXML2.DOMDocument40
    Public Function GetTestValues(pxmlReceive As MSXML2.DOMDocument30) As Boolean
    Dim mpxmlReceive As MSXML2.DOMDocument30
    Dim node As MSXML2.IXMLDOMNode
    Dim node2 As MSXML2.IXMLDOMNode

    Set mpxmlReceive = pxmlReceive

    Debug.Print “Start loop ”
    Set node = mpxmlReceive.selectSingleNode(“//ROAD_SEARCH_ENTRY”)
    With node.childNodes
    .Reset
    Set node2 = .nextNode
    Do While Not node2 Is Nothing
    Select Case node2.baseName
    Case “OTHER_USRN”
    Debug.Print “usrn ” & node2.Text
    Case “OTHER_ROADS_AND_FOOTWAYS”

    Case “ADDITIONAL_QUESTION”

    Case Else

    End Select
    Set node2 = .nextNode
    If node2 Is Nothing Then
    GoTo PROCEXIT
    End If
    Loop
    End With

    PROCEXIT:
    Debug.Print “Finished”

    GetTestValues = True

    End Function

    Viewing 0 reply threads
    Author
    Replies
    • #562995

      Do you have both library references loaded at the same time and are switching back and forth, or do you unload one before loading the other?

      Having two versions of an object model reference library loaded at the same time can cause some weird problems.

      I espick from espeeriance…

      I am interested in how you are using XML. What is the library reference to access the object model? Is it available (that is, a part of a standard Windows/IE install) or do you have to download the library to get at it?

      • #563058

        Nope, the only reference was to Microsoft XML, v4.0 (which is msxml4.dll)
        The only change to make the program work was the commenting out of the Document40 versus Document30, no changes to the referenced DLL
        Just getting started on using XML, hah, wish work had sent me on at least some training, I feel that a lot of my problems are ‘known’ issues that an expert would answer easily, but takes me a lot of time to find by looking through books and web searches.

        I got the MSXML 4.0 RTM parser from the Microsoft site at http:// http://msdn.microsoft.com/downloads/defaul…ompositedoc.xml [/url]

        Not standard (yet) in Windows/IE – just checked the Microsoft DLL Database (well recommended) at http://support.microsoft.com/servicedesks/…nfo.asp?sd=TECH [/url]
        and it shows that even WinXP only ships with the 3.0 parser, and in fact a search for msxml4* doesn’t get any hits, so maybe the RTM status means that I should go back to using the MSXML 3.0 for the time being doh

        What am I using it for, taking a data query from an ASP page, posting it into our database, then pulling out the users response to the query, and posting it back to the originator, at least that’s the goal smile

    Viewing 0 reply threads
    Reply To: MSXML 4.0 SelectSingleNode (VB6 SP5)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: