本文整理汇总了Java中com.intellij.xml.util.XmlUtil.findLocalNameByQualifiedName方法的典型用法代码示例。如果您正苦于以下问题:Java XmlUtil.findLocalNameByQualifiedName方法的具体用法?Java XmlUtil.findLocalNameByQualifiedName怎么用?Java XmlUtil.findLocalNameByQualifiedName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.xml.util.XmlUtil
的用法示例。
在下文中一共展示了XmlUtil.findLocalNameByQualifiedName方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getType
import com.intellij.xml.util.XmlUtil; //导入方法依赖的package包/类
@Nullable
public TypeDescriptor getType(XmlElement context) {
final XmlNSDescriptor nsDescriptor = getNSDescriptor(context);
if (!(nsDescriptor instanceof XmlNSTypeDescriptorProvider)) return null;
TypeDescriptor type = ((XmlNSTypeDescriptorProvider) nsDescriptor).getTypeDescriptor(myDescriptorTag);
if (type == null) {
String substAttr = myDescriptorTag.getAttributeValue("substitutionGroup");
if (substAttr != null) {
final String namespacePrefix = XmlUtil.findPrefixByQualifiedName(substAttr);
final String namespace = namespacePrefix.isEmpty() ?
getDefaultNamespace() :
myDescriptorTag.getNamespaceByPrefix(namespacePrefix);
final String local = XmlUtil.findLocalNameByQualifiedName(substAttr);
final XmlElementDescriptorImpl originalElement = (XmlElementDescriptorImpl)((XmlNSDescriptorImpl)getNSDescriptor()).getElementDescriptor(local, namespace);
if (originalElement != null && originalElement != this) {
type = originalElement.getType(context);
}
}
}
return type;
}
示例2: checkElementNameEquivalence
import com.intellij.xml.util.XmlUtil; //导入方法依赖的package包/类
private boolean checkElementNameEquivalence(String localName, String namespace, String fqn, XmlTag context){
final String localAttrName = XmlUtil.findLocalNameByQualifiedName(fqn);
if (!localAttrName.equals(localName)) return false;
final String attrNamespace = context.getNamespaceByPrefix(XmlUtil.findPrefixByQualifiedName(fqn));
if (attrNamespace.equals(namespace)) return true;
if(myTargetNamespace == null){
if(XmlUtil.EMPTY_URI.equals(attrNamespace))
return true;
}
else {
if (myTargetNamespace.equals(namespace)) return true;
return context.getNSDescriptor(namespace, true) == this; // schema's targetNamespace could be different from file systemId
}
return false;
}
示例3: initSubstitutes
import com.intellij.xml.util.XmlUtil; //导入方法依赖的package包/类
private boolean initSubstitutes() {
if (mySubstitutions == null && myTag != null) {
mySubstitutions = new MultiMap<String, XmlTag>();
if (myTag == null) return false;
XmlTag[] tags = myTag.getSubTags();
for (XmlTag tag : tags) {
if (equalsToSchemaName(tag, ELEMENT_TAG_NAME)) {
final String substAttr = tag.getAttributeValue("substitutionGroup");
if (substAttr != null) {
String substLocalName = XmlUtil.findLocalNameByQualifiedName(substAttr);
mySubstitutions.putValue(substLocalName, tag);
}
}
}
}
return mySubstitutions != null;
}
示例4: findRedefinedDescriptor
import com.intellij.xml.util.XmlUtil; //导入方法依赖的package包/类
@Nullable
public static XmlNSDescriptorImpl findRedefinedDescriptor(XmlTag tag, String text) {
final String localName = XmlUtil.findLocalNameByQualifiedName(text);
for(XmlTag parentTag = tag.getParentTag(); parentTag != null; parentTag = parentTag.getParentTag()) {
if (localName.equals(parentTag.getAttributeValue("name"))) {
final XmlTag grandParent = parentTag.getParentTag();
if (grandParent != null && "redefine".equals(grandParent.getLocalName())) {
return XmlNSDescriptorImpl.getRedefinedElementDescriptor(grandParent);
}
}
}
return null;
}
示例5: isElementWithEmbeddedType
import com.intellij.xml.util.XmlUtil; //导入方法依赖的package包/类
public static boolean isElementWithEmbeddedType(XmlTagImpl xml, final String typeName, final String typeNsPrefix) {
final String localName = xml.getLocalName();
if (! (XmlUtil.XML_SCHEMA_URI.equals(xml.getNamespace()) && "element".equals(localName))) {
return false;
}
final XmlAttribute nameAttr = getNameAttr(xml);
if (nameAttr == null || nameAttr.getValue() == null) return false;
final String localTypeName = XmlUtil.findLocalNameByQualifiedName(nameAttr.getValue());
final String prefix = XmlUtil.findPrefixByQualifiedName(nameAttr.getValue());
if (! typeName.equals(localTypeName) || ! typeNsPrefix.equals(prefix)) {
return false;
}
final XmlTag[] tags = xml.getSubTags();
for (XmlTag tag : tags) {
if (isTypeElement((XmlTagImpl)tag)) {
return true;
}
}
return false;
}
示例6: getName
import com.intellij.xml.util.XmlUtil; //导入方法依赖的package包/类
@Override
public String getName(PsiElement context){
String value = myDescriptorTag.getAttributeValue("name");
if(context instanceof XmlElement){
final String namespace = getNamespaceByContext(context);
final XmlTag tag = PsiTreeUtil.getParentOfType(context, XmlTag.class, false);
if(tag != null){
final String namespacePrefix = tag.getPrefixByNamespace(namespace);
if (namespacePrefix != null && namespacePrefix.length() > 0) {
final XmlTag rootTag = ((XmlFile)myDescriptorTag.getContainingFile()).getRootTag();
String elementFormDefault;
if (rootTag != null &&
( NONQUALIFIED_ATTR_VALUE.equals(elementFormDefault = rootTag.getAttributeValue(ELEMENT_FORM_DEFAULT)) || elementFormDefault == null /*unqualified is default*/) &&
tag.getNamespaceByPrefix("").isEmpty()
&& myDescriptorTag.getParentTag() != rootTag
) {
value = XmlUtil.findLocalNameByQualifiedName(value);
} else {
value = namespacePrefix + ":" + XmlUtil.findLocalNameByQualifiedName(value);
}
}
}
}
return value;
}
示例7: getAttributeDescriptorImpl
import com.intellij.xml.util.XmlUtil; //导入方法依赖的package包/类
@Nullable
private XmlAttributeDescriptor getAttributeDescriptorImpl(final String attributeName, XmlTag context) {
final String localName = XmlUtil.findLocalNameByQualifiedName(attributeName);
final String namespacePrefix = XmlUtil.findPrefixByQualifiedName(attributeName);
final String namespace = namespacePrefix.isEmpty() ?
getDefaultNamespace() :
context.getNamespaceByPrefix(namespacePrefix);
XmlAttributeDescriptor attribute = getAttribute(localName, namespace, context, attributeName);
if (attribute instanceof AnyXmlAttributeDescriptor) {
final ComplexTypeDescriptor.CanContainAttributeType containAttributeType =
((AnyXmlAttributeDescriptor)attribute).getCanContainAttributeType();
if (containAttributeType != ComplexTypeDescriptor.CanContainAttributeType.CanContainAny && !namespace.isEmpty()) {
final XmlNSDescriptor candidateNSDescriptor = context.getNSDescriptor(namespace, true);
if (candidateNSDescriptor instanceof XmlNSDescriptorImpl) {
final XmlNSDescriptorImpl nsDescriptor = (XmlNSDescriptorImpl)candidateNSDescriptor;
final XmlAttributeDescriptor xmlAttributeDescriptor = nsDescriptor.getAttribute(localName, namespace, context);
if (xmlAttributeDescriptor != null) return xmlAttributeDescriptor;
else {
if (containAttributeType == ComplexTypeDescriptor.CanContainAttributeType.CanContainButDoNotSkip) {
attribute = null;
}
}
}
}
}
return attribute;
}
示例8: getElementDescriptor
import com.intellij.xml.util.XmlUtil; //导入方法依赖的package包/类
@Nullable
public XmlElementDescriptor getElementDescriptor(final String name) {
final String localName = XmlUtil.findLocalNameByQualifiedName(name);
final String namespacePrefix = XmlUtil.findPrefixByQualifiedName(name);
final String namespace = namespacePrefix.isEmpty() ?
getDefaultNamespace() :
myDescriptorTag.getNamespaceByPrefix(namespacePrefix);
return getElementDescriptor(localName, namespace, null, name);
}
示例9: getTypeDescriptor
import com.intellij.xml.util.XmlUtil; //导入方法依赖的package包/类
@Override
public TypeDescriptor getTypeDescriptor(final String name, XmlTag context) {
if(checkSchemaNamespace(name, context)){
final String localNameByQualifiedName = XmlUtil.findLocalNameByQualifiedName(name);
if (STD_TYPES.contains(localNameByQualifiedName) &&
( name.length() == localNameByQualifiedName.length() ||
UNDECLARED_STD_TYPES.contains(localNameByQualifiedName)
)
)
return new StdTypeDescriptor(localNameByQualifiedName);
}
return findTypeDescriptor(name, context);
}
示例10: isCertainTypeElement
import com.intellij.xml.util.XmlUtil; //导入方法依赖的package包/类
private boolean isCertainTypeElement(XmlTagImpl xml, final String typeName, final String nsPrefix) {
if (! isTypeElement(xml)) return false;
final XmlAttribute name = getNameAttr(xml);
if (name == null) return false;
final String value = name.getValue();
if (value == null) return false;
final String localName = XmlUtil.findLocalNameByQualifiedName(value);
return typeName.equals(localName) && nsPrefix.equals(XmlUtil.findPrefixByQualifiedName(value));
}
示例11: checkTag
import com.intellij.xml.util.XmlUtil; //导入方法依赖的package包/类
@Override
protected void checkTag(@NotNull final XmlTag tag, @NotNull final ProblemsHolder holder, final boolean isOnTheFly) {
if (!(tag.getParent() instanceof XmlTag)) {
final PsiFile psiFile = tag.getContainingFile();
if (!(psiFile instanceof XmlFile)) {
return;
}
XmlFile xmlFile = (XmlFile) psiFile;
final XmlDocument document = xmlFile.getDocument();
if (document == null) {
return;
}
XmlProlog prolog = document.getProlog();
if (prolog == null || XmlHighlightVisitor.skipValidation(prolog)) {
return;
}
final XmlDoctype doctype = prolog.getDoctype();
if (doctype == null) {
return;
}
XmlElement nameElement = doctype.getNameElement();
if (nameElement == null) {
return;
}
String name = tag.getName();
String text = nameElement.getText();
if (tag instanceof HtmlTag) {
name = name.toLowerCase();
text = text.toLowerCase();
}
if (!name.equals(text)) {
name = XmlUtil.findLocalNameByQualifiedName(name);
if (!name.equals(text)) {
if (tag instanceof HtmlTag) {
return; // it is legal to have html / head / body omitted
}
final LocalQuickFix localQuickFix = new MyLocalQuickFix(doctype.getNameElement().getText());
holder.registerProblem(XmlChildRole.START_TAG_NAME_FINDER.findChild(tag.getNode()).getPsi(),
XmlErrorMessages.message("wrong.root.element"),
ProblemHighlightType.LIKE_UNKNOWN_SYMBOL, localQuickFix
);
final ASTNode astNode = XmlChildRole.CLOSING_TAG_NAME_FINDER.findChild(tag.getNode());
if (astNode != null) {
holder.registerProblem(astNode.getPsi(),
XmlErrorMessages.message("wrong.root.element"),
ProblemHighlightType.LIKE_UNKNOWN_SYMBOL, localQuickFix
);
}
}
}
}
}
示例12: getLocalName
import com.intellij.xml.util.XmlUtil; //导入方法依赖的package包/类
@Override
@NotNull
public String getLocalName() {
return XmlUtil.findLocalNameByQualifiedName(getName());
}