[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

in xpath query using prefix to locate a node

Posted on 2008-02-03
2
Medium Priority
?
654 Views
Last Modified: 2010-04-21
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

0
Comment
Question by:elgadaa
2 Comments
 
LVL 82

Accepted Solution

by:
hielo earned 2000 total points
ID: 20812475
>>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
 

Author Closing Comment

by:elgadaa
ID: 31427701
thanks, yes it works
0

Featured Post

Learn to develop an Android App

Want to increase your earning potential in 2018? Pad your resume with app building experience. Learn how with this hands-on course.

Question has a verified solution.

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

The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
Many times as a report developer I've been asked to display normalized data such as three rows with values Jack, Joe, and Bob as a single comma-separated string such as 'Jack, Joe, Bob', and vice versa.  Here's how to do it. 
There may be issues when you are trying to access Outlook or send & receive emails or due to Outlook crash which leads to corrupt or damaged PST file. To eliminate the corruption from your PST file, you need to repair the corrupt Outlook PST file. U…
Stellar Phoenix SQL Database Repair software easily fixes the suspect mode issue of SQL Server database. It is a simple process to bring the database from suspect mode to normal mode. Check out the video and fix the SQL database suspect mode problem.
Suggested Courses

591 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