|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectit.unimi.dsi.parser.HTMLFactory
public class HTMLFactory
A parsing factory for (X)HTML.
Warning: for maximum flexibility, the methods of this factory
do not perform case normalisation. If you are parsing HTML, you are invited
to downcase your names before accessing getElement(MutableString)
and getAttribute(MutableString)
.
This class is a singleton, and its only instance is accessible using the public field
INSTANCE
.
The relationship between this class and Element
/Attribute
is a bit
twisted due to the need to accomodate two features:
Element.A
);
To this purpose, this class exports packagewise some static factory methods that create Element
s and
Attribute
s and register them locally. The static initialisation code in
Element
and Attribute
creates elements such as Element.A
using the abovementioned
factory methods.
An alternative implementation could use reflection, but I don't see great advantages.
Field Summary | |
---|---|
static HTMLFactory |
INSTANCE
|
Method Summary | |
---|---|
Attribute |
getAttribute(MutableString name)
Returns the Attribute associated
to a name. |
Element |
getElement(MutableString name)
Returns the Element associated
to a name. |
Entity |
getEntity(MutableString name)
Returns the Entity associated
to a name. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final HTMLFactory INSTANCE
Method Detail |
---|
public Element getElement(MutableString name)
ParsingFactory
Element
associated
to a name.
getElement
in interface ParsingFactory
name
- the name of an element type.
Element
object.public Attribute getAttribute(MutableString name)
ParsingFactory
Attribute
associated
to a name.
getAttribute
in interface ParsingFactory
name
- the name of an attribute.
Attribute
object.public Entity getEntity(MutableString name)
ParsingFactory
Entity
associated
to a name.
getEntity
in interface ParsingFactory
name
- the name of an entity.
Entity
object.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |