JavaTM 2 Platform
Standard Ed. 6

javax.swing.text.html.parser
类 DTD

java.lang.Object
  继承者 javax.swing.text.html.parser.DTD
所有已实现的接口:
DTDConstants

public class DTD
extends Object
implements DTDConstants

SGML DTD 的表示形式。DTD 描述文档语法并用于解析 HTML 文档。它包含一个元素及其属性的列表,还包括一个在 DTD 中定义的条目的列表。

另请参见:
Element, AttributeList, ContentModel, Parser

字段摘要
 Element applet
           
 Element base
           
 Element body
           
 Hashtable<String,Element> elementHash
           
 Vector<Element> elements
           
 Hashtable<Object,Entity> entityHash
           
static int FILE_VERSION
           
 Element head
           
 Element html
           
 Element isindex
           
 Element meta
           
 String name
           
 Element p
           
 Element param
           
 Element pcdata
           
 Element title
           
 
从接口 javax.swing.text.html.parser.DTDConstants 继承的字段
ANY, CDATA, CONREF, CURRENT, DEFAULT, EMPTY, ENDTAG, ENTITIES, ENTITY, FIXED, GENERAL, ID, IDREF, IDREFS, IMPLIED, MD, MODEL, MS, NAME, NAMES, NMTOKEN, NMTOKENS, NOTATION, NUMBER, NUMBERS, NUTOKEN, NUTOKENS, PARAMETER, PI, PUBLIC, RCDATA, REQUIRED, SDATA, STARTTAG, SYSTEM
 
构造方法摘要
protected DTD(String name)
          创建具有指定名称的新 DTD。
 
方法摘要
protected  AttributeList defAttributeList(String name, int type, int modifier, String value, String values, AttributeList atts)
          创建并返回一个 AttributeList
protected  ContentModel defContentModel(int type, Object obj, ContentModel next)
          创建并返回一个新的内容模式。
protected  Element defElement(String name, int type, boolean omitStart, boolean omitEnd, ContentModel content, String[] exclusions, String[] inclusions, AttributeList atts)
          创建并返回一个 Element
 Entity defEntity(String name, int type, int ch)
          创建并返回一个字符 Entity
protected  Entity defEntity(String name, int type, String str)
          创建并返回一个 Entity
 void defineAttributes(String name, AttributeList atts)
          定义 Element 的属性。
 Element defineElement(String name, int type, boolean omitStart, boolean omitEnd, ContentModel content, BitSet exclusions, BitSet inclusions, AttributeList atts)
          返回与指定参数匹配的 Element
 Entity defineEntity(String name, int type, char[] data)
          定义一个实体。
static DTD getDTD(String name)
          返回具有指定 name 的 DTD。
 Element getElement(int index)
          按索引获取一个元素。
 Element getElement(String name)
          按名称获取一个元素。
 Entity getEntity(int ch)
          获取一个字符实体。
 Entity getEntity(String name)
          按名称获取一个实体。
 String getName()
          获取 DTD 的名称。
static void putDTDHash(String name, DTD dtd)
           
 void read(DataInputStream in)
          根据存档格式重新创建一个 DTD。
 String toString()
          返回此 DTD 的字符串表示形式。
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

字段详细信息

name

public String name

elements

public Vector<Element> elements

elementHash

public Hashtable<String,Element> elementHash

entityHash

public Hashtable<Object,Entity> entityHash

pcdata

public final Element pcdata

html

public final Element html

meta

public final Element meta

base

public final Element base

isindex

public final Element isindex

head

public final Element head

body

public final Element body

applet

public final Element applet

param

public final Element param

p

public final Element p

title

public final Element title

FILE_VERSION

public static final int FILE_VERSION
另请参见:
常量字段值
构造方法详细信息

DTD

protected DTD(String name)
创建具有指定名称的新 DTD。

参数:
name - 以 String 表示的新 DTD 的名称
方法详细信息

getName

public String getName()
获取 DTD 的名称。

返回:
DTD 的名称

getEntity

public Entity getEntity(String name)
按名称获取一个实体。

返回:
name String 对应的 Entity

getEntity

public Entity getEntity(int ch)
获取一个字符实体。

返回:
ch 字符对应的 Entity

getElement

public Element getElement(String name)
按名称获取一个元素。如果该元素不存在,将创建一个新元素。

参数:
name - 请求的 String
返回:
对应于 nameElement,它可以是新创建的

getElement

public Element getElement(int index)
按索引获取一个元素。

参数:
index - 请求的索引
返回:
index 相应的 Element

defineEntity

public Entity defineEntity(String name,
                           int type,
                           char[] data)
定义一个实体。如果由 nametypedata 指定的 Entity 存在,就返回该 Entity;否则将创建并返回一个新 Entity

参数:
name - 以 String 表示的 Entity 的名称
type - Entity 的类型
data - Entity 的数据
返回:
请求的 Entity,如果未找到请求的,则返回一个新 Entity

defineElement

public Element defineElement(String name,
                             int type,
                             boolean omitStart,
                             boolean omitEnd,
                             ContentModel content,
                             BitSet exclusions,
                             BitSet inclusions,
                             AttributeList atts)
返回与指定参数匹配的 Element。如果不存在所需元素,则创建并返回一个新元素。

参数:
name - Element 的名称
type - Element 的类型
omitStart - 如果忽略开始,则为 true
omitEnd - 如果忽略结尾,则为 true
content - ContentModel
atts - 指定 ElementAttributeList
返回:
指定的 Element

defineAttributes

public void defineAttributes(String name,
                             AttributeList atts)
定义 Element 的属性。

参数:
name - Element 的名称
atts - 指定 ElementAttributeList

defEntity

public Entity defEntity(String name,
                        int type,
                        int ch)
创建并返回一个字符 Entity

参数:
name - 实体的名称
返回:
新的字符 Entity

defEntity

protected Entity defEntity(String name,
                           int type,
                           String str)
创建并返回一个 Entity

参数:
name - 实体的名称
返回:
新的 Entity

defElement

protected Element defElement(String name,
                             int type,
                             boolean omitStart,
                             boolean omitEnd,
                             ContentModel content,
                             String[] exclusions,
                             String[] inclusions,
                             AttributeList atts)
创建并返回一个 Element

参数:
name - 元素的名称
返回:
新的 Element

defAttributeList

protected AttributeList defAttributeList(String name,
                                         int type,
                                         int modifier,
                                         String value,
                                         String values,
                                         AttributeList atts)
创建并返回一个 AttributeList

参数:
name - 属性列表的名称
返回:
新的 AttributeList

defContentModel

protected ContentModel defContentModel(int type,
                                       Object obj,
                                       ContentModel next)
创建并返回一个新的内容模式。

参数:
type - 新内容模式的类型
返回:
新的 ContentModel

toString

public String toString()
返回此 DTD 的字符串表示形式。

覆盖:
Object 中的 toString
返回:
此 DTD 的字符串表示形式

putDTDHash

public static void putDTDHash(String name,
                              DTD dtd)

getDTD

public static DTD getDTD(String name)
                  throws IOException
返回具有指定 name 的 DTD。如果不存在具有该名称的 DTD,将创建并返回一个 DTD。名称中的所有大写字符都将转换为小写字符。

参数:
name - DTD 的名称
返回:
name 对应的 DTD
抛出:
IOException

read

public void read(DataInputStream in)
          throws IOException
根据存档格式重新创建一个 DTD。

参数:
in - 要从中读取数据的 DataInputStream
抛出:
IOException

JavaTM 2 Platform
Standard Ed. 6

提交错误或意见

版权所有 2008 Sun Microsystems, Inc. 保留所有权利。请遵守GNU General Public License, version 2 only