I am trying to create a new Element using jsoup.
Element constructor:
Element(Tag tag, String baseUri, Attributes attributes)
I have problems instantiating the Tag object, because the constructor is not visible.
How can I obtain a Tag, apart from getting an existing one from another element?
Use the static generator method
valueOf:The reason that
Tagdoesn’t expose a constructor is that thevalueOfmethod can cache identical objects. For instance, this allows the following code: