Create my own Parsing rule

Must-share information (formatted with Markdown):

Version : SonarQube 7.9 LTS.
IDE : Eclipse
JRE 14

I am trying to set up my own custom rule with SonarQube. The rule i’m trying to set up is a XML Parser that checks if my pom.xml contains the following :

I followed the ArtifactIdNamingConventionRule already written by SonarQube in order to learn how to parse my pom.xml. What I am trying to do is to identified the right groupId that contains my project to know which artifactId my rule shall parse.

Where i’m stuck is here :

private XPathExpression artifactIdExpression = getXPathExpression("project/artifactId");
	private XPathExpression groupIdExpression = getXPathExpression("project/groupId");
	private Pattern pattern = null;

  public void scanFile(XmlFile file) {
	// If there's no pom.xml file
    if (!"pom.xml".equalsIgnoreCase(file.getInputFile().filename())) {
    // If there's no string nor <artifactId>
    NodeList artifactIds = evaluate(artifactIdExpression, file.getNamespaceUnawareDocument());
    if (artifactIds == null || artifactIds.getLength() != 1) {
    NodeList groupIds = evaluate(groupIdExpression, file.getNamespaceUnawareDocument());
    Node groupId = groupIds.item(0);  ***groupId is null***

    // If the project/groupId equals to the project named "${repository-name}"
    if (groupId.getTextContent().equals("${repository-name}")) {
	    Node artifactId = artifactIds.item(0);
	    if (!getPattern().matcher(artifactId.getTextContent()).matches()) {
	      reportIssue(artifactId, "Update this \"artifactId\" to match the provided regular expression: '" + regex + "'");