SonarXml custom rule not working

I have created one templated rule for XML language to check if some tag values satisfy the naming convention and through code smell if it doesn’t satisfy. I followed: https://docs.sonarqube.org/display/DEV/Adding+Coding+Rules+using+XPath , to create the rule. But seems like this rule is not getting executed.

The newly created templated rule looks like:

Check if NJR project component name starts with get

Parameters

filePattern The files to be validated using Ant-style matching patterns
expression The XPath query
Default Value //ELEMENT[./S_TAG/NAME/@tokenValue='types1:Name' and ./CONTENT[starts-with(@tokenValue, 'get')] ]
message The issue message
Default Value This xml doesn’t start with get

My XML structure:

<aetgt:getResponse xmlns:aetgt="http://schemas.active-endpoints.com/appmodules/repository/2010/10/avrepository.xsd"
                   xmlns:types1="http://schemas.active-endpoints.com/appmodules/repository/2010/10/avrepository.xsd">
   <<types1:Item>>
      <<types1:EntryId>>5x8iaaabbeJOSM8-gt-1226268-2019-05-17T22:06:46.907Z::pd.xml</types1:EntryId>
      <<types1:Name>>getSess-RunJob_PF</types1:Name>
   </types1:Item>
</aetgt:getResponse>

xpath query that i am using:

//ELEMENT[./S_TAG/NAME/@tokenValue='types1:Name' and ./CONTENT[starts-with(@tokenValue, 'get')] ]

In sslr-xml-toolkit i am able to select the element in AST with the above query. But in sonarqube this plugin doesn’t seems to work.

The documentation page you mention doesn’t list an SSLR toolkit for XML.
It’s easier than that: you can use an ordinary XPath expression.
In your case, you should try something like:

//*[local-name()='Name'][starts-with(., 'get')]