Solved

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

Posted on 2004-09-10
4
272 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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.

831 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