- java.lang.Object
-
- javax.swing.text.html.parser.DTD
-
- All Implemented Interfaces:
- DTDConstants
public class DTD extends Object implements DTDConstants
The representation of an SGML DTD. DTD describes a document syntax and is used in parsing of HTML documents. It contains a list of elements and their attributes as well as a list of entities defined in the DTD.- See Also:
Element
,AttributeList
,ContentModel
,Parser
-
-
Field Summary
Fields Modifier and Type Field and Description 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
-
Fields inherited from interface 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
-
-
Constructor Summary
Constructors Modifier Constructor and Description protected
DTD(String name)
Creates a new DTD with the specified name.
-
Method Summary
Methods Modifier and Type Method and Description protected AttributeList
defAttributeList(String name, int type, int modifier, String value, String values, AttributeList atts)
Creates and returns anAttributeList
.protected ContentModel
defContentModel(int type, Object obj, ContentModel next)
Creates and returns a new content model.protected Element
defElement(String name, int type, boolean omitStart, boolean omitEnd, ContentModel content, String[] exclusions, String[] inclusions, AttributeList atts)
Creates and returns anElement
.Entity
defEntity(String name, int type, int ch)
Creates and returns a characterEntity
.protected Entity
defEntity(String name, int type, String str)
Creates and returns anEntity
.void
defineAttributes(String name, AttributeList atts)
Defines attributes for anElement
.Element
defineElement(String name, int type, boolean omitStart, boolean omitEnd, ContentModel content, BitSet exclusions, BitSet inclusions, AttributeList atts)
Returns theElement
which matches the specified parameters.Entity
defineEntity(String name, int type, char[] data)
Defines an entity.static DTD
getDTD(String name)
Returns a DTD with the specifiedname
.Element
getElement(int index)
Gets an element by index.Element
getElement(String name)
Gets an element by name.Entity
getEntity(int ch)
Gets a character entity.Entity
getEntity(String name)
Gets an entity by name.String
getName()
Gets the name of the DTD.static void
putDTDHash(String name, DTD dtd)
void
read(DataInputStream in)
Recreates a DTD from an archived format.String
toString()
Returns a string representation of this DTD.
-
-
-
Field Detail
-
name
public String name
-
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
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DTD
protected DTD(String name)
Creates a new DTD with the specified name.- Parameters:
name
- the name, as aString
of the new DTD
-
-
Method Detail
-
getName
public String getName()
Gets the name of the DTD.- Returns:
- the name of the DTD
-
getEntity
public Entity getEntity(String name)
Gets an entity by name.- Returns:
- the
Entity
corresponding to thename
String
-
getEntity
public Entity getEntity(int ch)
Gets a character entity.- Returns:
- the
Entity
corresponding to thech
character
-
getElement
public Element getElement(String name)
Gets an element by name. A new element is created if the element doesn't exist.- Parameters:
name
- the requestedString
- Returns:
- the
Element
corresponding toname
, which may be newly created
-
getElement
public Element getElement(int index)
Gets an element by index.- Parameters:
index
- the requested index- Returns:
- the
Element
corresponding toindex
-
defineEntity
public Entity defineEntity(String name, int type, char[] data)
Defines an entity. If theEntity
specified byname
,type
, anddata
exists, it is returned; otherwise a newEntity
is created and is returned.- Parameters:
name
- the name of theEntity
as aString
type
- the type of theEntity
data
- theEntity
's data- Returns:
- the
Entity
requested or a newEntity
if not found
-
defineElement
public Element defineElement(String name, int type, boolean omitStart, boolean omitEnd, ContentModel content, BitSet exclusions, BitSet inclusions, AttributeList atts)
Returns theElement
which matches the specified parameters. If one doesn't exist, a new one is created and returned.- Parameters:
name
- the name of theElement
type
- the type of theElement
omitStart
-true
if start should be omittedomitEnd
-true
if end should be omittedcontent
- theContentModel
atts
- theAttributeList
specifying theElement
- Returns:
- the
Element
specified
-
defineAttributes
public void defineAttributes(String name, AttributeList atts)
Defines attributes for anElement
.- Parameters:
name
- the name of theElement
atts
- theAttributeList
specifying theElement
-
defEntity
public Entity defEntity(String name, int type, int ch)
Creates and returns a characterEntity
.- Parameters:
name
- the entity's name- Returns:
- the new character
Entity
-
defEntity
protected Entity defEntity(String name, int type, String str)
Creates and returns anEntity
.- Parameters:
name
- the entity's name- Returns:
- the new
Entity
-
defElement
protected Element defElement(String name, int type, boolean omitStart, boolean omitEnd, ContentModel content, String[] exclusions, String[] inclusions, AttributeList atts)
Creates and returns anElement
.- Parameters:
name
- the element's name- Returns:
- the new
Element
-
defAttributeList
protected AttributeList defAttributeList(String name, int type, int modifier, String value, String values, AttributeList atts)
Creates and returns anAttributeList
.- Parameters:
name
- the attribute list's name- Returns:
- the new
AttributeList
-
defContentModel
protected ContentModel defContentModel(int type, Object obj, ContentModel next)
Creates and returns a new content model.- Parameters:
type
- the type of the new content model- Returns:
- the new
ContentModel
-
toString
public String toString()
Returns a string representation of this DTD.
-
getDTD
public static DTD getDTD(String name) throws IOException
Returns a DTD with the specifiedname
. If a DTD with that name doesn't exist, one is created and returned. Any uppercase characters in the name are converted to lowercase.- Parameters:
name
- the name of the DTD- Returns:
- the DTD which corresponds to
name
- Throws:
IOException
-
read
public void read(DataInputStream in) throws IOException
Recreates a DTD from an archived format.- Parameters:
in
- theDataInputStream
to read from- Throws:
IOException
-
-
Nederlandse vertaling
U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.
Bij voorbaat dank.
Document heeft de 11/06/2005 gemaakt, de laatste keer de 04/03/2020 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/java-api-rf-javax/swing/text/html/parser/dtd.html
De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.
Referenties
Deze verwijzingen en links verwijzen naar documenten die geraadpleegd zijn tijdens het schrijven van deze pagina, of die aanvullende informatie kunnen geven, maar de auteurs van deze bronnen kunnen niet verantwoordelijk worden gehouden voor de inhoud van deze pagina.
De auteur Deze site is als enige verantwoordelijk voor de manier waarop de verschillende concepten, en de vrijheden die met de referentiewerken worden genomen, hier worden gepresenteerd. Vergeet niet dat u meerdere broninformatie moet doorgeven om het risico op fouten te verkleinen.