String (PsiFile file, int offset, String uri) { final PsiElement currentElement = file.findElementAt(offset); final XmlAttribute attribute = PsiTreeUtil.getParentOfType(currentElement, XmlAttribute.class); if (attribute != null) { final XmlTag tag = PsiTreeUtil.getParentOfType(currentElement, XmlTag.class); if (tag != null) { final String prefix = tag.getPrefixByNamespace(XmlUtil.XML_SCHEMA_INSTANCE_URI); if (prefix != null) { final String attrValue = tag.getAttributeValue(XmlUtil.SCHEMA_LOCATION_ATT, XmlUtil.XML_SCHEMA_INSTANCE_URI); if (attrValue != null) { final StringTokenizer tokenizer = new StringTokenizer(attrValue); while (tokenizer.hasMoreElements()) { if (uri.equals(tokenizer.nextToken())) { if (!tokenizer.hasMoreElements()) return uri; final String url = tokenizer.nextToken(); return url.startsWith(HTTP_PROTOCOL) ? url : uri; } if (!tokenizer.hasMoreElements()) return uri; tokenizer.nextToken(); // skip file location } } } } } return uri; }