Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2004-09-10
4
Medium Priority
?
279 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 500 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
Make the most of your online learning experience.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

963 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