c# - xpath where clause returning 0 nodes -


my clause in xpath expression not working , returning 0. cannot figure out wrong. code here. value of currentrelationship variable 'testentity_relname.';

var entity = doc.selectnodes(string.format("//settings/entity[relationshipname={0}]", currentrelationship)).cast<xmlnode>().tolist(); 

and xml document looks this;

<settings>   <accessrighttypes>     <accessrighttype>writeaccess</accessrighttype>     <accessrighttype>shareaccess</accessrighttype>     <accessrighttype>readaccess</accessrighttype>     <accessrighttype>noneaccess</accessrighttype>     <accessrighttype>deleteaccess</accessrighttype>     <accessrighttype>createaccess</accessrighttype>     <accessrighttype>assignaccess</accessrighttype>     <accessrighttype>appendtoaccess</accessrighttype>     <accessrighttype>appendaccess</accessrighttype>   </accessrighttypes>   <entity>     <relationshipname>testentity_relname.</relationshipname>     <accessright>readaccess</accessright>     <accessright>writeaccess</accessright>   </entity> </settings> 

if use xpath expression of "//settings/entity" single entity node back. again, clause not work. , info appreciated.

looks you're missing single quotes around argument in xpath format string.

var entity = doc.selectnodes(string.format("//settings/entity[relationshipname='{0}']", currentrelationship)).cast<xmlnode>().tolist(); 

Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -