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
Post a Comment