in xpath query using prefix to locate a node

I am trying to using nodeselect to locate a node but the nodename has prefix " CS3000GR:". I recieve an error expected token eof found Name /svg[3]/g[0]/GCS3000-->:-->Modifier[0].
Call xmlDoc.Load(strPath & strFileName)
        If xmlDoc.parseError.errorCode = 0 Then
        
            xmlDoc.SetProperty "SelectionNamespaces", "xmlns:xsl='http://www.w3.org/1999/XSL/Transform'"
            xmlDoc.SetProperty "SelectionLanguage", "XPath"
           
            rstdata.Filter = "FileName =" & strFileName
            Set objNodeList = xmlDoc.documentElement.childNodes
            Do While Not rstdata.EOF
            
            If rstdata!Modify = "replace" Then
                If rstdata!Type = "element" Then
                  'Ci = VBA.CInt(VBA.Val(VBA.Right(rstdata!pointer, 1)))
                  'strXML = "[" & Ci & "]"
                  strXML = rstdata!xml_space
                    Set objNode = xmlDoc.documentElement.selectSingleNode(strXML)

Open in new window

elgadaaAsked:
Who is Participating?
 
hieloCommented:
>>has prefix "CS3000GR:".
If I understand you correctly, the "prefix" you are referring to is actually a namespace. Meaning you have nodes that look similar to (for example):
<CS3000GR:Name></CS3000GR:Name>

If so, you need to include the namespace in the "SelectionNamespaces" property:
xmlDoc.SetProperty "SelectionNamespaces", "xmlns:xsl='http://www.w3.org/1999/XSL/Transform',xmlns:CS3000GR='http://www.yoursite.com'"
0
 
elgadaaAuthor Commented:
thanks, yes it works
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.