public class HTMLFactory extends Object implements ParsingFactory
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.
Modifier and Type | Field and Description |
---|---|
static HTMLFactory |
INSTANCE |
Modifier and Type | Method and Description |
---|---|
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. |
public static final HTMLFactory INSTANCE
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.Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.