c# - xpath query to select element where attribute not present -


what should xpath query select element attribute att not present.

<root>   <elem att='the value' />   <elem att='the value' />   <elem att='the value' />   **<elem />**   <elem att='the value' />   <elem att='the value' /> </root> 

i want update element attribute att not present.

thanks

you can use [@att] test presence of attribute, need:

//elem[not(@att)] 

... test absence of it.

(tested using xpathtester)


Comments

Popular posts from this blog

C# random value from dictionary and tuple -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -

cgi - How do I interpret URLs without extension as files rather than missing directories in nginx? -