Custom Xpath Rule not working for Xaml

HI

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

Hi,

Welcome to the community!

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

 
Ann

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

Hi,

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

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.

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

It Works Elena :slight_smile: Thanks a lot …!