Class TagSet
java.lang.Object
org.jsoup.parser.TagSet
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionInsert a tag into this TagSet.boolean@Nullable TagGet an existing Tag from this TagSet by tagName and namespace.inthashCode()static TagSetHtml()Returns a mutable copy of the default HTML tag set.Register a callback to customize eachTagas it's added to this TagSet.Get a Tag by name from this TagSet.valueOf(String tagName, String namespace, ParseSettings settings) Get a Tag by name from this TagSet.
-
Constructor Details
-
TagSet
public TagSet() -
TagSet
-
-
Method Details
-
Html
-
add
-
get
-
valueOf
Get a Tag by name from this TagSet. If not previously defined (unknown), returns a new tag.New tags will be added to this TagSet.
- Parameters:
tagName- Name of tag, e.g. "p".namespace- the namespace for the tag.settings- used to control tag name sensitivity- Returns:
- The tag, either defined or new generic.
-
valueOf
Get a Tag by name from this TagSet. If not previously defined (unknown), returns a new tag.New tags will be added to this TagSet.
- Parameters:
tagName- Name of tag, e.g. "p". Case-sensitive.namespace- the namespace for the tag.- Returns:
- The tag, either defined or new generic.
- See Also:
-
onNewTag
Register a callback to customize eachTagas it's added to this TagSet.Customizers are invoked once per Tag, when they are added (explicitly or via the valueOf methods).
For example, to allow all unknown tags to be self-closing during when parsing as HTML:
Parser parser = Parser.htmlParser(); parser.tagSet().onNewTag(tag -> { if (!tag.isKnownTag()) tag.set(Tag.SelfClose); }); Document doc = Jsoup.parse(html, parser);- Parameters:
customizer- aConsumer<Tag>that will be called for each newly added or cloned Tag; callers can inspect and modify the Tag's state (e.g. set options)- Returns:
- this TagSet, to allow method chaining
- Since:
- 1.21.0
-
equals
-
hashCode
-