Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2004-09-10
4
Medium Priority
?
278 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
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…

721 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