Class SvgElementFactory

  • All Implemented Interfaces:
    ElementFactory

    public class SvgElementFactory
    extends java.lang.Object
    implements ElementFactory
    Element factory which creates elements by calling the constructor on a given SvgElement subclass.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static java.lang.Class<?>[] CLASSES_  
      private static java.util.Map<java.lang.String,​java.lang.Class<?>> ELEMENTS_  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      DomElement createElement​(SgmlPage page, java.lang.String tagName, org.xml.sax.Attributes attributes)
      Creates an element according to this factory's specification.
      DomElement 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.
      DomElement createElementNS​(SgmlPage page, java.lang.String namespaceURI, java.lang.String qualifiedNameLC, org.xml.sax.Attributes attributes, boolean checkBrowserCompatibility)
      Creates an element according to this factory's specification.
      boolean isSupported​(java.lang.String tagNameLowerCase)
      Returns whether the specified name is a valid SVG tag name.
      private static java.util.Map<java.lang.String,​DomAttr> toMap​(SgmlPage page, org.xml.sax.Attributes attributes)  
      • Methods inherited from class java.lang.Object

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

      • CLASSES_

        private static final java.lang.Class<?>[] CLASSES_
      • ELEMENTS_

        private static final java.util.Map<java.lang.String,​java.lang.Class<?>> ELEMENTS_
    • Constructor Detail

      • SvgElementFactory

        public SvgElementFactory()
    • Method Detail

      • createElement

        public DomElement createElement​(SgmlPage page,
                                        java.lang.String tagName,
                                        org.xml.sax.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:
        createElement in interface ElementFactory
        Parameters:
        page - the enclosing page for the new element
        tagName - 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 (possibly null if no attributes specified
        Returns:
        the newly created and initialized element
      • createElementNS

        public DomElement 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. 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 enclosing page for the new element
        namespaceURI - the URI that identifies an XML namespace
        qualifiedName - the qualified name of the element type to instantiate
        attributes - the attributes encountered during XML/HTML parsing (possibly null if no attributes specified
        Returns:
        the newly created and initialized element
      • createElementNS

        public DomElement createElementNS​(SgmlPage page,
                                          java.lang.String namespaceURI,
                                          java.lang.String qualifiedNameLC,
                                          org.xml.sax.Attributes attributes,
                                          boolean checkBrowserCompatibility)
        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 enclosing page for the new element
        namespaceURI - the URI that identifies an XML namespace
        qualifiedNameLC - the qualified name of the element type to instantiate
        attributes - the attributes encountered during XML/HTML parsing (possibly null if no attributes specified
        checkBrowserCompatibility - if true and the page doesn't support this element, return null
        Returns:
        the newly created and initialized element
      • toMap

        private static java.util.Map<java.lang.String,​DomAttr> toMap​(SgmlPage page,
                                                                           org.xml.sax.Attributes attributes)
      • isSupported

        public boolean isSupported​(java.lang.String tagNameLowerCase)
        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