Solved

XML replaceData method keep getting "Object doesn't support this property or method"

Posted on 2004-09-10
4
271 Views
Last Modified: 2010-04-17
I keep getting an "Object doesn't support this property or method" whenever I call the XML replaceData method.  I'm basically trying to replace the value of element A with the value of element B.  Please advise.  Thanks for your help.

DNice30

'===========================
Const XML_ELEM_TOOLTIPCOL="TOOLTIPCOLUMN"
Const XML_ELEM_NAME="NAME"
Const XML_ELEM_COLUMN="COLUMN"
Dim sColName, sToolTipVal
Dim oXMLDoc, oCol, oName
Dim i

Set oXMLDoc = Server.CreateObject("MSXML2.FreeThreadedDOMDocument.3.0")      
oXMLDoc.async = False
oXMLDoc.loadXML(sDomColumns)
      
Set oCol=oXMLDoc.selectNodes("//COLUMN[NAME][TOOLTIP]")

For i=0 To (oCol.length-1)
      With oCol.item(i)
            sToolTipVal=Trim(UCase(.getElementsByTagName(XML_ELEM_TOOLTIPCOL).item(0).text))
            Set oName=.getElementsByTagName(XML_ELEM_NAME)
            Call oName.item(0).replaceData(0, 0, sToolTipVal)  '<<error here>>
      End With
Next
Set oName=Nothing
Set oXMLDoc=Nothing
Set oCol=Nothing
'===========================
0
Comment
Question by:DNice30
  • 2
  • 2
4 Comments
 
LVL 1

Expert Comment

by:tser
ID: 12030986

Have you check if oName actually contain a list of nodes ?
i.e. Any chance oName or oName.item(0) is NULL
0
 

Author Comment

by:DNice30
ID: 12044541
Thanks for your response tser.  I do get a value returned if I simply Response.Write oName.item(0).text.  But still for some reason, the replaceData method is not available for this object.
0
 
LVL 1

Accepted Solution

by:
tser earned 125 total points
ID: 12046028
oName.item(0) is probably an XMLDOMElement
replaceData is a method of XMLDOMText.

I believe
oName.item(0).firstChild.replaceData(0, 0, sToolTipVal) will work

but to be safe, you'll have to check the nodeType of oName.item(0).firstChild and make sure
it is NODE_TEXT (numerical value is 3)

0
 

Author Comment

by:DNice30
ID: 12047490
Thanks, tser.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
This is about my first experience with programming Arduino.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now