模块 java.desktop

类 Element

java.lang.Object
javax.swing.text.html.parser.Element
所有已实现的接口:
Serializable , DTDConstants

public final class Element extends Object implements DTDConstants , Serializable
使用 ELEMENT 构造在 DTD 中描述的元素。这是标签的基本描述。它描述了类型、内容模型、属性、属性类型等。解析器使用它来正确解析文档。
参见:
  • 字段详细信息

    • index

      public int index
      元素索引
    • name

      public String  name
      元素名称
    • oStart

      public boolean oStart
      true 如果开始标签可以省略
    • oEnd

      public boolean oEnd
      true 如果可以省略结束标记
    • inclusions

      public BitSet  inclusions
      元素内部可能出现的元素集合
    • exclusions

      public BitSet  exclusions
      不得出现在元素内部的元素集
    • type

      public int type
      元素类型
    • content

      public ContentModel  content
      内容模型
    • atts

      public AttributeList  atts
      属性
    • data

      public Object  data
      存储用户数据的字段。主要用于存储样式表。
  • 方法详情

    • getName

      public String  getName()
      获取元素的名称。
      返回:
      元素的名称
    • omitStart

      public boolean omitStart()
      如果可以省略开始标记,则返回 true。
      返回:
      true 如果开始标签可以省略
    • omitEnd

      public boolean omitEnd()
      如果可以省略结束标记,则返回 true。
      返回:
      true 如果可以省略结束标记
    • getType

      public int getType()
      获取类型。
      返回:
      元素的类型
    • getContent

      public ContentModel  getContent()
      获取内容模型
      返回:
      内容模型
    • getAttributes

      public AttributeList  getAttributes()
      获取属性。
      返回:
      AttributeList 指定元素
    • getIndex

      public int getIndex()
      获取索引。
      返回:
      元素索引
    • isEmpty

      public boolean isEmpty()
      检查是否为空
      返回:
      如果当前元素为空则为真
    • toString

      public String  toString()
      转换为字符串。
      重写:
      toString 在类 Object
      返回:
      给定 Element 实例的字符串表示
    • getAttribute

      public AttributeList  getAttribute(String  name)
      按名称获取属性。
      参数:
      name - 属性名称
      返回:
      给定 nameAttributeList
    • getAttributeByValue

      public AttributeList  getAttributeByValue(String  value)
      按值获取属性。
      参数:
      value - 值的字符串表示
      返回:
      给定 valueAttributeList
    • name2type

      public static int name2type(String  nm)
      nm 转换为类型。如果 nm 等于 CDATA、RCDATA、EMPTY 或 ANY,则返回适当的 DTDConstants,否则返回 0。
      参数:
      nm - 一个名字
      返回:
      如果 nm 等于 CDATA、RCDATA、EMPTY 或 ANY,则为适当的 DTDConstants,否则为 0。