public class

Tag

extends Object
java.lang.Object
   ↳ org.jsoup.parser.Tag

Class Overview

HTML Tag specifications. This is a very simplistic model without the full expressiveness as the DTD, but it should capture most of what we need to know to intelligently parse a doc.

Summary

Public Methods
boolean canContainBlock()
Gets if this tag can contain block tags.
boolean equals(Object o)
boolean formatAsBlock()
Gets if this tag should be formatted as a block (or as inline)
String getName()
int hashCode()
boolean isBlock()
Gets if this is a block tag.
boolean isData()
Gets if this tag is a data only tag.
boolean isEmpty()
Get if this is an empty tag
boolean isInline()
Gets if this tag is an inline tag.
boolean isKnownTag()
Get if this is a pre-defined tag, or was auto created on parsing.
boolean isSelfClosing()
Get if this tag is self closing.
boolean preserveWhitespace()
Get if this tag should preserve whitespace within child text nodes.
String toString()
static Tag valueOf(String tagName)
Get a Tag by name.
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public boolean canContainBlock ()

Gets if this tag can contain block tags.

Returns
  • if tag can contain block tags

public boolean equals (Object o)

public boolean formatAsBlock ()

Gets if this tag should be formatted as a block (or as inline)

Returns
  • if should be formatted as block or inline

public String getName ()

public int hashCode ()

public boolean isBlock ()

Gets if this is a block tag.

Returns
  • if block tag

public boolean isData ()

Gets if this tag is a data only tag.

Returns
  • if this tag is a data only tag

public boolean isEmpty ()

Get if this is an empty tag

Returns
  • if this is an emtpy tag

public boolean isInline ()

Gets if this tag is an inline tag.

Returns
  • if this tag is an inline tag.

public boolean isKnownTag ()

Get if this is a pre-defined tag, or was auto created on parsing.

Returns
  • if a known tag

public boolean isSelfClosing ()

Get if this tag is self closing.

Returns
  • if this tag should be output as self closing.

public boolean preserveWhitespace ()

Get if this tag should preserve whitespace within child text nodes.

Returns
  • if preserve whitepace

public String toString ()

public static Tag valueOf (String tagName)

Get a Tag by name. If not previously defined (unknown), returns a new generic tag, that can do anything.

Pre-defined tags (P, DIV etc) will be ==, but unknown tags are not registered and will only .equals().

Parameters
tagName Name of tag, e.g. "p". Case insensitive.
Returns
  • The tag, either defined or new generic.