|
-
Oct 21st, 2005, 01:46 PM
#1
Thread Starter
Lively Member
XPath Invalid Token in Query String
Not sure if this is a question for the XML forum or the VB .Net forum but here goes. I am trying to use the VB .Net Xml.XmlNode object's SelectSingleNode method to grab a node I need. The XML string I am searching looks something like this.
<DataRow rowNumber="251">
<RowData rowType="item" value="MD:Z-Bar 4' Length" />
<ColData colID="1" value="Z-Bar 4' Length" />
<ColData colID="2" value="Z-Bar 4' Length" />
<ColData colID="4" value="10" />
<ColData colID="5" value="75" />
<ColData colID="6" value="0" />
<ColData colID="7" value="75" />
<ColData colID="8" value="false" />
<ColData colID="9" value="0" />
<ColData colID="11" value="0" />
</DataRow>
I try to grab the node from a larger list of DataRow node via the following VB .Net Code
VB Code:
MyNode.SelectSingleNode( MyValidPathString & "DataRow[RowData [value=('MD:Z-Bar 4' Length')]]/ColData [@colID='5']").Attributes("value").InnerXml
At this line of code an System.Xml.XPath.XPathException is thrown with the message:
MyValidPathString & "DataRow[RowData [value=('MD:Z-Bar 4' Length')]]/ColData [@colID='5']' has an invalid token.
I know the cause of this is the apostrophe in my search string, MD:Z-Bar 4' Length, but I do not know how to get the node I need any other way. I tried:
'MD:Z-Bar 4" Length'
'MD:Z-Bar 4' Length'
"MD:Z-Bar 4' Length"
'MD:Z-Bar 4'' Length'
etc....
Can anyone help me out?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|