com.intellij.psi.xml.XmlTag#getNamespace ( )源码实例Demo

下面列出了com.intellij.psi.xml.XmlTag#getNamespace ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

private boolean isDevKitConfig(XmlTag tag, XmlFile baseFile) {
    Module module = ModuleUtilCore.findModuleForPsiElement(baseFile);

    String namespace = tag.getNamespace();
    List<XmlSchemaProvider> providers = XmlSchemaProvider.getAvailableProviders(baseFile);

    for (XmlSchemaProvider provider : providers) {
        Set<String> locations = provider.getLocations(namespace, baseFile);
        for (String location : locations) {
            XmlFile schema = provider.getSchema(location, module, baseFile);
            if (schema != null) {
                String schemaFile = schema.getText();
                if (schemaFile.contains("http://www.mulesoft.org/schema/mule/devkit")) {
                    return true;
                }
            }
        }
    }

    return false;
}
 
protected boolean isNamespaceBound(PsiElement psiElement) {
    PsiElement parent = psiElement.getParent();
    if (!(parent instanceof XmlTag)) return false;
    final XmlTag tag = (XmlTag) parent;
    final XmlElementDescriptor tagDescriptor = tag.getDescriptor();
    final String tagNamespace = tag.getNamespace();
    return tagDescriptor != null && !(tagDescriptor instanceof AnyXmlElementDescriptor) && namespace.equals(tagNamespace);
}
 
源代码3 项目: camel-idea-plugin   文件: XmlCamelIdeaUtils.java
@Override
public boolean skipEndpointValidation(PsiElement element) {
    // only accept xml tags from namespaces we support
    XmlTag xml = PsiTreeUtil.getParentOfType(element, XmlTag.class);
    if (xml != null) {
        String ns = xml.getNamespace();
        // accept empty namespace which can be from testing
        boolean accepted = StringUtils.isEmpty(ns) || isAcceptedNamespace(ns);
        LOG.trace("XmlTag " + xml.getName() + " with namespace: " + ns + " is accepted namespace: " + accepted);
        return !accepted; // skip is the opposite
    }

    return false;
}
 
源代码4 项目: mule-intellij-plugins   文件: MuleConfigUtils.java
public static QName getQName(XmlTag xmlTag) {
    return new QName(xmlTag.getNamespace(), xmlTag.getLocalName());
}