javax.swing.text.html

Class HTML


public class HTML
extends Object

HTML attribute and tag definitions.

Nested Class Summary

static class
HTML.Attribute
Represents a HTML attribute.
static class
HTML.Tag
Represents a HTML tag.
static class
HTML.UnknownTag
Represents an unknown HTML tag.

Field Summary

static String
NULL_ATTRIBUTE_VALUE
This value is returned for attributes without value that have no default value defined in the DTD.

Constructor Summary

HTML()
The public constructor (does nothing).

Method Summary

static HTML.Attribute[]
getAllAttributeKeys()
Returns the set of the recognized HTML attributes.
static HTML.Tag[]
getAllTags()
Returns the set of actual HTML tags that are recognized by the default HTML reader.
static HTML.Attribute
getAttributeKey(String attName)
Returns an htl attribute constant for the given attribute name.
static int
getIntegerAttributeValue(AttributeSet set, HTML.Attribute attribute, int defaultValue)
Searches the value of given attribute in the provided set.
static HTML.Tag
getTag(String tagName)
Returns a HTML tag constant for the given HTML attribute name.

Methods inherited from class java.lang.Object

clone, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Details

NULL_ATTRIBUTE_VALUE

public static final String NULL_ATTRIBUTE_VALUE
This value is returned for attributes without value that have no default value defined in the DTD.
Field Value:
"#DEFAULT"

Constructor Details

HTML

public HTML()
The public constructor (does nothing). It it seldom required to have an instance of this class, because all public fields and methods are static.

Method Details

getAllAttributeKeys

public static HTML.Attribute[] getAllAttributeKeys()
Returns the set of the recognized HTML attributes.

getAllTags

public static HTML.Tag[] getAllTags()
Returns the set of actual HTML tags that are recognized by the default HTML reader. The returned array does not include the COMMENT, CONTENT and IMPLIED tags.

getAttributeKey

public static HTML.Attribute getAttributeKey(String attName)
Returns an htl attribute constant for the given attribute name.
Parameters:
attName - the attribute name, case insensitive

getIntegerAttributeValue

public static int getIntegerAttributeValue(AttributeSet set,
                                           HTML.Attribute attribute,
                                           int defaultValue)
Searches the value of given attribute in the provided set. If the value is found (String type expected), tries to parse it as an integer value. If succeded, returns the obtained integer value. For example:

SimpleAttributeSet ase = new SimpleAttributeSet(); ase.addAttribute(HTML.getAttributeKey("size"),"222"); System.out.println( HTML.getIntegerAttributeValue (ase, HTML.getAttributeKey("size"), 333)); // prints "222" System.out.println( HTML.getIntegerAttributeValue (ase, HTML.getAttributeKey("width"), 333)); // prints "333".

Parameters:
set - The attribute set to search in. If the set contains the given attribute, it must by a type of String.
attribute - The html attribute to search in
defaultValue - The value that is returned if the attribute is not found in the given set or if the NumberFormatException was thrown during the parsing.

getTag

public static HTML.Tag getTag(String tagName)
Returns a HTML tag constant for the given HTML attribute name. If the tag is unknown, the null is returned.
Parameters:
tagName - the tag name, case insensitive

HTML.java -- HTML document tag constants Copyright (C) 2002 Free Software Foundation, Inc. This file is part of GNU Classpath. GNU Classpath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. GNU Classpath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and conditions of the GNU General Public License cover the whole combination. As a special exception, the copyright holders of this library give you permission to link this library with independent modules to produce an executable, regardless of the license terms of these independent modules, and to copy and distribute the resulting executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and conditions of the license of that module. An independent module is a module which is not derived from or based on this library. If you modify this library, you may extend this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version.