use of com.gargoylesoftware.htmlunit.html.UnknownElementFactory in project htmlunit by HtmlUnit.
the class HtmlUnitNekoHTMLErrorHandler method getElementFactory.
/**
* <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br>
*
* Returns the pre-registered element factory corresponding to the specified tag, or an UnknownElementFactory.
* @param page the page
* @param namespaceURI the namespace URI
* @param qualifiedName the qualified name
* @param insideSvg is the node inside an SVG node or not
* @param svgSupport true if called from javascript createElementNS
* @return the pre-registered element factory corresponding to the specified tag, or an UnknownElementFactory
*/
@Override
public ElementFactory getElementFactory(final SgmlPage page, final String namespaceURI, final String qualifiedName, final boolean insideSvg, final boolean svgSupport) {
if (insideSvg) {
return SVG_FACTORY;
}
if (namespaceURI == null || namespaceURI.isEmpty() || Html.XHTML_NAMESPACE.equals(namespaceURI) || Html.SVG_NAMESPACE.equals(namespaceURI) || !qualifiedName.contains(":")) {
String tagName = qualifiedName;
final int index = tagName.indexOf(':');
if (index == -1) {
tagName = tagName.toLowerCase(Locale.ROOT);
} else {
tagName = tagName.substring(index + 1);
}
final ElementFactory factory;
if (svgSupport && !"svg".equals(tagName) && Html.SVG_NAMESPACE.equals(namespaceURI)) {
factory = SVG_FACTORY;
} else {
factory = ELEMENT_FACTORIES.get(tagName);
}
if (factory != null) {
return factory;
}
}
return UnknownElementFactory.instance;
}
Aggregations