Solved

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

Posted on 2004-09-10
4
268 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
Comment Utility

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
Comment Utility
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
Comment Utility
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
Comment Utility
Thanks, tser.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Excel object stays open 19 64
stringclean challenge 26 54
delphi parse string to params 3 80
creating threads in delphi 1 49
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.
If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
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 …

762 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

13 Experts available now in Live!

Get 1:1 Help Now