void (XmlDocument t) { try { final XmlFile psiFile = (XmlFile)t.getContainingFile(); final XPath searchPath; final Pattern pattern; final Context context; if (myMatchRecursively) { searchPath = mySupport.createXPath(psiFile, "//*"); searchPath.setVariableContext(new CachedVariableContext(myExpression.variables, searchPath, t)); pattern = PatternParser.parse(myExpression.expression); final ContextSupport support = new ContextSupport(searchPath.getNamespaceContext(), searchPath.getFunctionContext(), searchPath.getVariableContext(), searchPath.getNavigator()); context = new Context(support); } else { searchPath = mySupport.createXPath(psiFile, myExpression.expression, myExpression.namespaces); searchPath.setVariableContext(new CachedVariableContext(myExpression.variables, searchPath, t)); pattern = null; context = null; } final Object o = searchPath.evaluate(t); if (o instanceof List) { //noinspection unchecked final List<PsiElement> list = ((List<PsiElement>)o); for (PsiElement psiElement : list) { myIndicator.checkCanceled(); if (myMatchRecursively) { if (pattern.matches(psiElement, context)) { matchFound(); myProcessor.process(new UsageInfo2UsageAdapter(new UsageInfo(psiElement))); } } else { matchFound(); myProcessor.process(new UsageInfo2UsageAdapter(new UsageInfo(psiElement))); } } } else if (Boolean.TRUE.equals(o)) { matchFound(); myProcessor.process(new UsageInfo2UsageAdapter(new UsageInfo(psiFile))); } else if (o instanceof Number) { if (((Number)o).intValue() != 0) { matchFound(); myProcessor.process(new UsageInfo2UsageAdapter(new UsageInfo(psiFile))); } } else if (o instanceof String) { if (((String)o).length() > 0) { matchFound(); myProcessor.process(new UsageInfo2UsageAdapter(new UsageInfo(psiFile))); } } } catch (JaxenException e) { Messages.showErrorDialog(myProject, XPathBundle.message("dialog.message.error.while.evaluating.xpath", e.getMessage()), XPathBundle.message("dialog.title.xpath.error")); } catch (SAXPathException e) { Logger.getInstance(getClass().getName()).error(e); } }