Custom Xpath Rule not working for Xaml


I am trying to write a custom rule for the below xaml file . The rule works properly in external tools available to validate Xpath .However , it is not flagging in SonarQube. My xaml file

New Text Document.txt (5.4 KB)
xpath query : count(Activity/Sequence//ui:SendOutlookMail/ui:SendOutlookMail.Files/scg:List/InArgument[not(contains(text(),"["))]) > 0

Need help


Welcome to the community!

The custom XPath rule templates only support XPath 1.0. Is that what you used?


1 Like

Yes, the rule is made up of xpath 1.0 only . It works in other sites but not with Sonarqube


Your XPath expression returns boolean. It should return nodes of the XML in order to rule to report something.

1 Like

Hi Elena

Thanks for the reply. We are creating custom rules,

we have other rules configured in the same way , i.e it returns Boolean . If a Boolean value is True , it will show that particular rule in Issues.

Removing namespaces from the xpath fixed the problem:
count(Activity/Sequence/SendOutlookMail/SendOutlookMail.Files/List/InArgument[not(contains(text(),"["))]) > 0

Not sure why it does not work with the namespaces.

1 Like

Thanks a lot, I will check and confirm it back to u :slight_smile:

It Works Elena :slight_smile: Thanks a lot …!