java.lang.Object
org.htmlunit.svg.SvgElementFactory
- All Implemented Interfaces:
ElementFactory
Element factory which creates elements by calling the constructor on a
given
SvgElement subclass.- Author:
- Ahmed Ashour, Frank Danek, Ronald Brill
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringadjustTagNameForHtmlParser(String tagName) Returns the name of an svg element created by the html parser; the name is lowercased and the case of some names is restored (e.g.createElement(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.booleanisSupported(String tagNameLowerCase) Returns whether the specified name is a valid SVG tag name.
-
Constructor Details
-
SvgElementFactory
public SvgElementFactory()
-
-
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 DomElement 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
-
adjustTagNameForHtmlParser
Returns the name of an svg element created by the html parser; the name is lowercased and the case of some names is restored (e.g. 'foreignobject' becomes 'foreignObject') like the browsers do it.- Parameters:
tagName- the tag name from the html source- Returns:
- the adjusted tag name
- See Also:
-
isSupported
Returns whether the specified name is a valid SVG tag name.- Parameters:
tagNameLowerCase- the tag name in lower case- Returns:
- whether the specified name is a valid SVG tag name or not
-