本文整理汇总了Java中com.intellij.xml.impl.dtd.XmlElementDescriptorImpl类的典型用法代码示例。如果您正苦于以下问题:Java XmlElementDescriptorImpl类的具体用法?Java XmlElementDescriptorImpl怎么用?Java XmlElementDescriptorImpl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XmlElementDescriptorImpl类属于com.intellij.xml.impl.dtd包,在下文中一共展示了XmlElementDescriptorImpl类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testElementDescriptor4
import com.intellij.xml.impl.dtd.XmlElementDescriptorImpl; //导入依赖的package包/类
public void testElementDescriptor4() throws Exception {
XmlNSDescriptor NSDescriptor = createDescriptor(
"<!ELEMENT orion-application (ejb-module*, persistence?, namespace-access)>" +
"<!ELEMENT ejb-module ANY>" +
"<!ELEMENT persistence ANY>" +
"<!ELEMENT namespace-access ANY>");
XmlTag documentTag = tag("orion-application");
XmlElementDescriptorImpl elementDescriptor = (XmlElementDescriptorImpl)NSDescriptor.getElementDescriptor(documentTag);
XmlElementDescriptor[] elements = elementDescriptor.getElementsDescriptors(documentTag);
assertEquals(3, elements.length);
assertEquals("ejb-module", elements[0].getName());
assertEquals("persistence", elements[1].getName());
assertEquals("namespace-access", elements[2].getName());
elements = elements[0].getElementsDescriptors(documentTag);
assertEquals(4, elements.length);
assertEquals("orion-application", elements[0].getName());
assertEquals("ejb-module", elements[1].getName());
assertEquals("persistence", elements[2].getName());
assertEquals("namespace-access", elements[3].getName());
}
示例2: getLocationString
import com.intellij.xml.impl.dtd.XmlElementDescriptorImpl; //导入依赖的package包/类
@Override
public String getLocationString() {
final XmlElement owner = (XmlElement)getElement();
final XmlAttlistDecl[] attLists= owner instanceof XmlElementDecl ? XmlElementDescriptorImpl.getCachedAttributeDeclarations(owner): XmlAttlistDecl.EMPTY_ARRAY;
if (attLists.length > 0) {
Map<String,XmlAttributeDecl> attrMap = null;
final String name = getElement().getName();
for(XmlAttlistDecl a:attLists) {
final String aname = a.getName();
if (!Comparing.equal(aname, name)) continue;
if (attrMap == null) attrMap = new LinkedHashMap<String, XmlAttributeDecl>();
for(XmlAttributeDecl d : a.getAttributeDecls()) {
attrMap.put(d.getName(), d);
}
}
StringBuilder b = null;
if (attrMap != null) {
for(Map.Entry<String,XmlAttributeDecl> e:attrMap.entrySet()) {
if (b == null) b = new StringBuilder();
else b.append(", ");
b.append(e.getKey());
final XmlAttributeDecl attributeDecl = e.getValue();
String type = null;
if (attributeDecl.isIdAttribute()) {
type = ID;
} else if (attributeDecl.isIdRefAttribute()) {
type = IDREF;
} else if (attributeDecl.isEnumerated()) {
type = ENUM;
}
if (attributeDecl.isAttributeFixed()) {
if (type == null) type = FIXED;
else type += " " + FIXED;
} else if (attributeDecl.isAttributeRequired()) {
if (type == null) type = REQUIRED;
else type += " " + REQUIRED;
} else if (attributeDecl.isAttributeImplied()) {
if (type == null) type = IMPLIED;
else type += " " + IMPLIED;
}
if (type != null) b.append(':').append(type);
final XmlAttributeValue value = attributeDecl.getDefaultValue();
if (value != null) b.append("=").append(value);
}
}
if (b != null) return b.toString();
}
return super.getLocationString();
}
示例3: getLocationString
import com.intellij.xml.impl.dtd.XmlElementDescriptorImpl; //导入依赖的package包/类
public String getLocationString() {
final XmlElement owner = (XmlElement)getElement();
final XmlAttlistDecl[] attLists= owner instanceof XmlElementDecl ? XmlElementDescriptorImpl.getCachedAttributeDeclarations(owner): XmlAttlistDecl.EMPTY_ARRAY;
if (attLists.length > 0) {
Map<String,XmlAttributeDecl> attrMap = null;
final String name = getElement().getName();
for(XmlAttlistDecl a:attLists) {
final String aname = a.getName();
if (!Comparing.equal(aname, name)) continue;
if (attrMap == null) attrMap = new LinkedHashMap<String, XmlAttributeDecl>();
for(XmlAttributeDecl d : a.getAttributeDecls()) {
attrMap.put(d.getName(), d);
}
}
StringBuilder b = null;
if (attrMap != null) {
for(Map.Entry<String,XmlAttributeDecl> e:attrMap.entrySet()) {
if (b == null) b = new StringBuilder();
else b.append(", ");
b.append(e.getKey());
final XmlAttributeDecl attributeDecl = e.getValue();
String type = null;
if (attributeDecl.isIdAttribute()) {
type = ID;
} else if (attributeDecl.isIdRefAttribute()) {
type = IDREF;
} else if (attributeDecl.isEnumerated()) {
type = ENUM;
}
if (attributeDecl.isAttributeFixed()) {
if (type == null) type = FIXED;
else type += " " + FIXED;
} else if (attributeDecl.isAttributeRequired()) {
if (type == null) type = REQUIRED;
else type += " " + REQUIRED;
} else if (attributeDecl.isAttributeImplied()) {
if (type == null) type = IMPLIED;
else type += " " + IMPLIED;
}
if (type != null) b.append(':').append(type);
final XmlAttributeValue value = attributeDecl.getDefaultValue();
if (value != null) b.append("=").append(value);
}
}
if (b != null) return b.toString();
}
return super.getLocationString();
}