public static enum Content.CType extends java.lang.Enum<Content.CType>
instanceoftype conditionals.
instanceofis not a particularly safe way to test content in JDOM because CDATA extends Text ( a CDATA instance is an
instanceofText). This CType enumeration provides a direct and sure mechanism for identifying JDOM content. These can be used in switch-type statements too (which is much neater than chained if (instanceof) else if (instanceof) else .... expressions):
switch(content.getCType()) { case Text : ..... break; case CDATA : ..... break; .... }
枚举常量和说明 |
---|
CDATA
Represents
CDATA content |
Comment
Represents
Comment content |
DocType
Represents
DocType content |
Element
Represents
Element content |
EntityRef
Represents
EntityRef content |
ProcessingInstruction
Represents
ProcessingInstruction content |
Text
Represents
Text content |
限定符和类型 | 方法和说明 |
---|---|
static Content.CType |
valueOf(java.lang.String name)
返回带有指定名称的该类型的枚举常量。
|
static Content.CType[] |
values()
按照声明该枚举类型的常量的顺序, 返回
包含这些常量的数组。
|
public static final Content.CType Comment
Comment
contentpublic static final Content.CType Element
Element
contentpublic static final Content.CType ProcessingInstruction
ProcessingInstruction
contentpublic static final Content.CType EntityRef
EntityRef
contentpublic static final Content.CType Text
Text
contentpublic static final Content.CType CDATA
CDATA
contentpublic static final Content.CType DocType
DocType
contentpublic static Content.CType[] values()
for (Content.CType c : Content.CType.values()) System.out.println(c);
public static Content.CType valueOf(java.lang.String name)
name
- 要返回的枚举常量的名称。java.lang.IllegalArgumentException
- 如果该枚举类型没有带有指定名称的常量java.lang.NullPointerException
- 如果参数为空值