java.lang.Object
org.htmlunit.html.DefaultElementFactory
- All Implemented Interfaces:
ElementFactory
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
Element factory which creates elements by calling the constructor on a given
Element factory which creates elements by calling the constructor on a given
HtmlElement subclass.
The constructor is expected to take 2 arguments of type
HtmlPage and Map
where the first one is the owning page of the element, the second one is a map
holding the initial attributes for the element.- Author:
- Christian Sell, Marc Guillemot, Ahmed Ashour, David K. Taylor, Dmitri Zoubkov, Ronald Brill, Frank Danek
-
Field Summary
FieldsModifier and TypeFieldDescriptionYou can generate your own test cases by looking into org.htmlunit.source.ElementTestSource#generateTestForHtmlElements(String, String). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateElement(SgmlPage page, String tagName, Attributes attributes) Creates an element according to this factory's specification.createElementNS(SgmlPage page, String namespaceURI, String qualifiedName, Attributes attributes) Creates an element according to this factory's specification.
-
Field Details
-
SUPPORTED_TAGS_
You can generate your own test cases by looking into org.htmlunit.source.ElementTestSource#generateTestForHtmlElements(String, String).
-
-
Constructor Details
-
DefaultElementFactory
public DefaultElementFactory()
-
-
Method Details
-
createElement
Creates an element according to this factory's specification. Note that even though this method takes a page parameter, the element is not automatically added to the page's DOM tree.- Specified by:
createElementin interfaceElementFactory- Parameters:
page- the enclosing page for the new elementtagName- the tag name (most factories will be responsible for a specific tag, but this parameter is passed in for factories that don't follow this rule)attributes- the attributes encountered during XML/HTML parsing (possiblynullif no attributes specified- Returns:
- the newly created and initialized element
-
createElementNS
public HtmlElement createElementNS(SgmlPage page, String namespaceURI, String qualifiedName, Attributes attributes) Creates an element according to this factory's specification. Note that even though this method takes a page parameter, the element is not automatically added to the page's DOM tree.- Specified by:
createElementNSin interfaceElementFactory- Parameters:
page- the enclosing page for the new elementnamespaceURI- the URI that identifies an XML namespacequalifiedName- the qualified name of the element type to instantiateattributes- the attributes encountered during XML/HTML parsing (possiblynullif no attributes specified- Returns:
- the newly created and initialized element
-