I am having a problem with my xpath queries in C#.
I have the following xml file:
When i try to select the select_sql like so:
The return String is "usernamestringselect * from users" where I want it to be "select * from users". I checked tutorials on XPath but it seems I must be doing it correctly but I have no idea what.
Thanks.
I have the following xml file:
Code:
<?xml version="1.0" encoding="utf-8" ?>
<config>
<data_module>
<table_name>users</table_name>
<fields>
<field>
<name>name</name>
<type>string</type>
</field>
</fields>
<select_sql>select * from users</select_sql>
</data_module>
</config>
When i try to select the select_sql like so:
Code:
// Doc is a XPathDocument already correctly loaded
XPathNavigator nav = doc.CreateNavigator();
XPathExpression expr = nav.Compile("/config/data_module/select_sql");
XPathNodeIterator nodeIter = nav.Select(expr);
String returnStr = (String)nodeIter.Current.Value;
The return String is "usernamestringselect * from users" where I want it to be "select * from users". I checked tutorials on XPath but it seems I must be doing it correctly but I have no idea what.
Thanks.