You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Mike Collins <m_...@email.msn.com> on 2000/12/08 22:57:21 UTC
Possible problem with the COM wrapper
I sent this before. It may have been lost in the shuffle. Anyway, here it
is, if anyone would care to shed some light on this.
I'm trying to use the COM wrapper with a Visual Basic 5.0 test project. The
project includes a single VB form and a reference to the Xerces COM object.
The code works fine until it reaches the VB For Each...Next construct. The
XML file being read is very simple (see attachment). Here's the code:
Private Sub Form_Load()
On Error GoTo ErrorTrap
Dim objDOMDocument As Xerces.DOMDocument
Dim objRoot As Xerces.IXMLDOMElement
Dim objNode As Xerces.IXMLDOMNode
Set objDOMDocument = New Xerces.DOMDocument
With objDOMDocument
.async = False
.Load "ao10588.xml"
If .parseError.reason <> "" Then
MsgBox .parseError.reason
Else
Set objRoot = .documentElement
' The next line causes a fatal error...
If objRoot.hasChildNodes Then
For Each objNode In objRoot.childNodes
Debug.Print objNode.nodeName
Next objNode
End If
End If
End With
Exit Sub
ErrorTrap:
MsgBox Err.Description, Err.Number
End Sub