use of com.intellij.xml.XmlNSDescriptor in project intellij-community by JetBrains.
the class XmlDtdTest method testAttributeDescriptor4.
public void testAttributeDescriptor4() throws Exception {
XmlNSDescriptor NSDescriptor = createDescriptor("<!ELEMENT toc ANY> <!ATTLIST toc remote (true|false) \"false\">");
final XmlTag tag = tag("toc");
XmlElementDescriptor elementDescriptor = NSDescriptor.getElementDescriptor(tag);
XmlAttributeDescriptor attributeDescriptor = elementDescriptor.getAttributeDescriptor("remote", tag);
assertTrue(!attributeDescriptor.isRequired());
assertTrue(!attributeDescriptor.isFixed());
assertTrue(attributeDescriptor.isEnumerated());
assertEquals("false", attributeDescriptor.getDefaultValue());
String[] values = attributeDescriptor.getEnumeratedValues();
assertEquals(2, values.length);
assertEquals("true", values[0]);
assertEquals("false", values[1]);
}
use of com.intellij.xml.XmlNSDescriptor in project intellij-community by JetBrains.
the class XmlDtdTest method testAttributeDescriptor1.
public void testAttributeDescriptor1() throws Exception {
XmlNSDescriptor NSDescriptor = createDescriptor("<!ELEMENT principals ANY><!ATTLIST principals path CDATA #IMPLIED>");
final XmlTag tag = tag("principals");
XmlElementDescriptor elementDescriptor = NSDescriptor.getElementDescriptor(tag);
XmlAttributeDescriptor attributeDescriptor = elementDescriptor.getAttributeDescriptor("path", tag);
assertEquals("path", attributeDescriptor.getName());
assertTrue(!attributeDescriptor.isRequired());
assertTrue(!attributeDescriptor.isFixed());
assertTrue(!attributeDescriptor.isEnumerated());
assertNull(attributeDescriptor.getDefaultValue());
}
use of com.intellij.xml.XmlNSDescriptor in project intellij-community by JetBrains.
the class XmlDtdTest method testElementDescriptor2.
public void testElementDescriptor2() throws Exception {
XmlNSDescriptor NSDescriptor = createDescriptor("<!ELEMENT principals (#PCDATA)><!ELEMENT data-sources ANY>" + "<!ELEMENT read-access (namespace-resource)><!ELEMENT group EMPTY>");
XmlElementDescriptor elementDescriptor = NSDescriptor.getElementDescriptor(tag("principals"));
assertEquals(elementDescriptor.getContentType(), XmlElementDescriptor.CONTENT_TYPE_MIXED);
elementDescriptor = NSDescriptor.getElementDescriptor(tag("data-sources"));
assertEquals(elementDescriptor.getContentType(), XmlElementDescriptor.CONTENT_TYPE_ANY);
elementDescriptor = NSDescriptor.getElementDescriptor(tag("read-access"));
assertEquals(elementDescriptor.getContentType(), XmlElementDescriptor.CONTENT_TYPE_CHILDREN);
elementDescriptor = NSDescriptor.getElementDescriptor(tag("group"));
assertEquals(elementDescriptor.getContentType(), XmlElementDescriptor.CONTENT_TYPE_EMPTY);
}
use of com.intellij.xml.XmlNSDescriptor in project intellij-community by JetBrains.
the class XmlDtdTest method testAttributeDescriptor3.
public void testAttributeDescriptor3() throws Exception {
XmlNSDescriptor NSDescriptor = createDescriptor("<!ELEMENT toc ANY> <!ATTLIST toc version CDATA #FIXED \"1.0\">");
final XmlTag tag = tag("toc");
XmlElementDescriptor elementDescriptor = NSDescriptor.getElementDescriptor(tag);
XmlAttributeDescriptor attributeDescriptor = elementDescriptor.getAttributeDescriptor("version", tag);
assertTrue(!attributeDescriptor.isRequired());
assertTrue(attributeDescriptor.isFixed());
assertTrue(!attributeDescriptor.isEnumerated());
assertEquals("1.0", attributeDescriptor.getDefaultValue());
}
use of com.intellij.xml.XmlNSDescriptor in project intellij-community by JetBrains.
the class XmlDtdTest method testAttributeDescriptor2.
public void testAttributeDescriptor2() throws Exception {
XmlNSDescriptor NSDescriptor = createDescriptor("<!ELEMENT principals ANY><!ATTLIST principals path CDATA #IMPLIED>");
final XmlTag tag = tag("principals");
XmlElementDescriptor elementDescriptor = NSDescriptor.getElementDescriptor(tag);
XmlAttributeDescriptor attributeDescriptor = elementDescriptor.getAttributeDescriptor("path", tag);
assertTrue(!attributeDescriptor.isRequired());
assertTrue(!attributeDescriptor.isFixed());
assertTrue(!attributeDescriptor.isEnumerated());
assertNull(attributeDescriptor.getDefaultValue());
}
Aggregations