Class DefaultElementFactory

  • All Implemented Interfaces:
    ElementFactory

    public class DefaultElementFactory
    extends java.lang.Object
    implements 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 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.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static java.lang.String KEYGEN_  
      private static org.apache.commons.logging.Log LOG
      Logging support.
      static java.util.List<java.lang.String> SUPPORTED_TAGS_
      You can generate your own test cases by looking into ElementTestSource.generateTestForHtmlElements.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      HtmlElement createElement​(SgmlPage page, java.lang.String tagName, org.xml.sax.Attributes attributes)
      Creates an element according to this factory's specification.
      HtmlElement createElementNS​(SgmlPage page, java.lang.String namespaceURI, java.lang.String qualifiedName, org.xml.sax.Attributes attributes)
      Creates an element according to this factory's specification.
      HtmlElement createElementNS​(SgmlPage page, java.lang.String namespaceURI, java.lang.String qualifiedName, org.xml.sax.Attributes attributes, boolean checkBrowserCompatibility)
      Creates an element according to this factory's specification.
      private HtmlElement createInputElement​(java.lang.String qualifiedName, SgmlPage page, java.util.Map<java.lang.String,​DomAttr> attributeMap)  
      (package private) static java.util.Map<java.lang.String,​DomAttr> toMap​(SgmlPage page, org.xml.sax.Attributes attributes)
      Converts Attributes into the map needed by HtmlElements.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • LOG

        private static final org.apache.commons.logging.Log LOG
        Logging support.
      • SUPPORTED_TAGS_

        public static final java.util.List<java.lang.String> SUPPORTED_TAGS_
        You can generate your own test cases by looking into ElementTestSource.generateTestForHtmlElements.
    • Constructor Detail

      • DefaultElementFactory

        public DefaultElementFactory()
    • Method Detail

      • createElement

        public HtmlElement createElement​(SgmlPage page,
                                         java.lang.String tagName,
                                         org.xml.sax.Attributes attributes)
        Description copied from interface: ElementFactory
        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:
        createElement in interface ElementFactory
        Parameters:
        page - the owning page
        tagName - the HTML tag name
        attributes - initial attributes, possibly null
        Returns:
        the newly created element
      • createElementNS

        public HtmlElement createElementNS​(SgmlPage page,
                                           java.lang.String namespaceURI,
                                           java.lang.String qualifiedName,
                                           org.xml.sax.Attributes attributes)
        Description copied from interface: ElementFactory
        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:
        createElementNS in interface ElementFactory
        Parameters:
        page - the owning page
        namespaceURI - the URI that identifies an XML namespace
        qualifiedName - the qualified name of the element type to instantiate
        attributes - initial attributes, possibly null
        Returns:
        the newly created element
      • createElementNS

        public HtmlElement createElementNS​(SgmlPage page,
                                           java.lang.String namespaceURI,
                                           java.lang.String qualifiedName,
                                           org.xml.sax.Attributes attributes,
                                           boolean checkBrowserCompatibility)
        Description copied from interface: ElementFactory
        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:
        createElementNS in interface ElementFactory
        Parameters:
        page - the owning page
        namespaceURI - the URI that identifies an XML namespace
        qualifiedName - the qualified name of the element type to instantiate
        attributes - initial attributes, possibly null
        checkBrowserCompatibility - if true and the page doesn't support this element, return null
        Returns:
        the newly created element
      • toMap

        static java.util.Map<java.lang.String,​DomAttr> toMap​(SgmlPage page,
                                                                   org.xml.sax.Attributes attributes)
        Converts Attributes into the map needed by HtmlElements.
        Parameters:
        page - the page which contains the specified attributes
        attributes - the SAX attributes
        Returns:
        the map of attribute values for HtmlElements
      • createInputElement

        private HtmlElement createInputElement​(java.lang.String qualifiedName,
                                               SgmlPage page,
                                               java.util.Map<java.lang.String,​DomAttr> attributeMap)