Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AppendChild gives Error 438

Status
Not open for further replies.

sjakiePP

Programmer
Apr 6, 2004
104
NL
In my Dictionary I have several DOMDocuments. These are taken out of the dict with XMLDocAOHA. To append this document to a Node I have to convert the DomDocument to an IXMLNode. I'm using Xpath to do this.

Then I am adding the new XMLNode to XMLNodeBasisBody, but then I get Error 438. What causes this error?

Code:
If dicNummerAanduidingen.Exists(strHoofdAdres) Then
  'as DomDocument
  Set XMLDocAOHA = dicNummerAanduidingen.Item(strHoofdAdres)
  'add to body, casted to node. doc is not ok
  ' selectsinglenode returns a node
  Set XMLNode = XMLDocAOHA.selectSingleNode("/")
                
  'As DomNode
  Set XMLNode = dicNummerAanduidingen.Item(strHoofdAdres)
  XMLNodeBasisBody.appendChild (XMLNode)
Else
  Err.Raise 32001, "Samengesteld.maakSamengesteldBericht", "No Hoofdadres found for " & strHoofdAdres
End If

(I have translated the comments to English)

---------------------------------------------
Yes, the world is full of strange people.
 
When trying to append the 438-Error is thrown, but my XMLNode is appended to my XMLNodeBasisBody. So I have put On Error Resume Next above it, so it does not bother me again, and again, and again, and again......

Did anyone else have this problem?

---------------------------------------------
Yes, the world is full of strange people.
 
[1] You have two different lines defining XMLNode. The second line, I do not recognize what it is. In any case, these methods Exists(), Item() in your context, are they proprietary?

[2] This is just a beautiful misunderstanding if XMLDocAOHA is a DOMDocument:
>[tt]Set XMLNode = XMLDocAOHA.selectSingleNode("/")[/tt]
XMLNode is exactly the same as XMLDocAOHA, a DOMDocument. It is not any other type.

[2.1] If you want to append it, use this definition should do.
>Set XMLNode = XMLDocAOHA.selectSingleNode("/")
[tt]Set XMLNode = XMLDocAOHA.DocumentElement[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top