void (XPathNodeTest nodeTest) { final ContextProvider contextProvider = ContextProvider.getContextProvider(nodeTest.getContainingFile()); final XmlElement contextNode = contextProvider.getContextElement(); final NamespaceContext namespaceContext = contextProvider.getNamespaceContext(); if (namespaceContext == null) return; if (nodeTest.isNameTest() && contextNode != null) { final PrefixedName prefixedName = nodeTest.getQName(); assert prefixedName != null; if (!"*".equals(prefixedName.getLocalName()) && !"*".equals(prefixedName.getPrefix())) { boolean found; if (nodeTest.getPrincipalType() == XPathNodeTest.PrincipalType.ELEMENT) { final Set<QName> elementNames = contextProvider.getElements(true); if (elementNames != null) { found = false; for (QName pair : elementNames) { if (matches(nodeTest.getQName(), pair, namespaceContext, contextNode, true)) { found = true; break; } } if (!found) { registerProblem(contextProvider, prefixedName, nodeTest, false); } } } else if (nodeTest.getPrincipalType() == XPathNodeTest.PrincipalType.ATTRIBUTE) { final Set<QName> attributeNames = contextProvider.getAttributes(true); if (attributeNames != null) { found = false; for (QName pair : attributeNames) { if (matches(nodeTest.getQName(), pair, namespaceContext, contextNode, false)) { found = true; break; } } if (!found) { registerProblem(contextProvider, prefixedName, nodeTest, true); } } } } } }