Class HtmlTreeBuilder


  • public class HtmlTreeBuilder
    extends TreeBuilder
    HTML Tree Builder; creates a DOM from Tokens.
    • Field Detail

      • TagsSearchInScope

        static final java.lang.String[] TagsSearchInScope
      • TagSearchList

        static final java.lang.String[] TagSearchList
      • TagSearchButton

        static final java.lang.String[] TagSearchButton
      • TagSearchTableScope

        static final java.lang.String[] TagSearchTableScope
      • TagSearchSelectScope

        static final java.lang.String[] TagSearchSelectScope
      • TagSearchEndTags

        static final java.lang.String[] TagSearchEndTags
      • TagThoroughSearchEndTags

        static final java.lang.String[] TagThoroughSearchEndTags
      • TagSearchSpecial

        static final java.lang.String[] TagSearchSpecial
      • baseUriSetFromDoc

        private boolean baseUriSetFromDoc
      • headElement

        @Nullable
        private Element headElement
      • formElement

        @Nullable
        private FormElement formElement
      • contextElement

        @Nullable
        private Element contextElement
      • formattingElements

        private java.util.ArrayList<Element> formattingElements
      • pendingTableCharacters

        private java.util.List<java.lang.String> pendingTableCharacters
      • framesetOk

        private boolean framesetOk
      • fosterInserts

        private boolean fosterInserts
      • fragmentParsing

        private boolean fragmentParsing
      • specificScopeTarget

        private java.lang.String[] specificScopeTarget
      • maxUsedFormattingElements

        private static final int maxUsedFormattingElements
        See Also:
        Constant Field Values
    • Constructor Detail

      • HtmlTreeBuilder

        public HtmlTreeBuilder()
    • Method Detail

      • initialiseParse

        @ParametersAreNonnullByDefault
        protected void initialiseParse​(java.io.Reader input,
                                       java.lang.String baseUri,
                                       Parser parser)
        Overrides:
        initialiseParse in class TreeBuilder
      • parseFragment

        java.util.List<Node> parseFragment​(java.lang.String inputFragment,
                                           @Nullable
                                           Element context,
                                           java.lang.String baseUri,
                                           Parser parser)
        Specified by:
        parseFragment in class TreeBuilder
      • markInsertionMode

        void markInsertionMode()
      • framesetOk

        void framesetOk​(boolean framesetOk)
      • framesetOk

        boolean framesetOk()
      • getBaseUri

        java.lang.String getBaseUri()
      • maybeSetBaseUri

        void maybeSetBaseUri​(Element base)
      • isFragmentParsing

        boolean isFragmentParsing()
      • insertStartTag

        Element insertStartTag​(java.lang.String startTagName)
      • insert

        void insert​(Element el)
      • insertNode

        private void insertNode​(Node node)
      • push

        void push​(Element element)
      • getStack

        java.util.ArrayList<Element> getStack()
      • onStack

        boolean onStack​(Element el)
      • onStack

        boolean onStack​(java.lang.String elName)
      • onStack

        private static boolean onStack​(java.util.ArrayList<Element> queue,
                                       Element element)
      • getFromStack

        @Nullable
        Element getFromStack​(java.lang.String elName)
      • removeFromStack

        boolean removeFromStack​(Element el)
      • popStackToClose

        @Nullable
        Element popStackToClose​(java.lang.String elName)
      • popStackToClose

        void popStackToClose​(java.lang.String... elNames)
      • popStackToBefore

        void popStackToBefore​(java.lang.String elName)
      • clearStackToTableContext

        void clearStackToTableContext()
      • clearStackToTableBodyContext

        void clearStackToTableBodyContext()
      • clearStackToTableRowContext

        void clearStackToTableRowContext()
      • clearStackToContext

        private void clearStackToContext​(java.lang.String... nodeNames)
      • insertOnStackAfter

        void insertOnStackAfter​(Element after,
                                Element in)
      • replaceInQueue

        private void replaceInQueue​(java.util.ArrayList<Element> queue,
                                    Element out,
                                    Element in)
      • resetInsertionMode

        void resetInsertionMode()
      • inSpecificScope

        private boolean inSpecificScope​(java.lang.String targetName,
                                        java.lang.String[] baseTypes,
                                        java.lang.String[] extraTypes)
      • inSpecificScope

        private boolean inSpecificScope​(java.lang.String[] targetNames,
                                        java.lang.String[] baseTypes,
                                        java.lang.String[] extraTypes)
      • inScope

        boolean inScope​(java.lang.String[] targetNames)
      • inScope

        boolean inScope​(java.lang.String targetName)
      • inScope

        boolean inScope​(java.lang.String targetName,
                        java.lang.String[] extras)
      • inListItemScope

        boolean inListItemScope​(java.lang.String targetName)
      • inButtonScope

        boolean inButtonScope​(java.lang.String targetName)
      • inTableScope

        boolean inTableScope​(java.lang.String targetName)
      • inSelectScope

        boolean inSelectScope​(java.lang.String targetName)
      • setHeadElement

        void setHeadElement​(Element headElement)
      • getHeadElement

        Element getHeadElement()
      • isFosterInserts

        boolean isFosterInserts()
      • setFosterInserts

        void setFosterInserts​(boolean fosterInserts)
      • getFormElement

        @Nullable
        FormElement getFormElement()
      • setFormElement

        void setFormElement​(FormElement formElement)
      • newPendingTableCharacters

        void newPendingTableCharacters()
      • getPendingTableCharacters

        java.util.List<java.lang.String> getPendingTableCharacters()
      • generateImpliedEndTags

        void generateImpliedEndTags​(java.lang.String excludeTag)
        13.2.6.3 Closing elements that have implied end tags When the steps below require the UA to generate implied end tags, then, while the current node is a dd element, a dt element, an li element, an optgroup element, an option element, a p element, an rb element, an rp element, an rt element, or an rtc element, the UA must pop the current node off the stack of open elements. If a step requires the UA to generate implied end tags but lists an element to exclude from the process, then the UA must perform the above steps as if that element was not in the above list. When the steps below require the UA to generate all implied end tags thoroughly, then, while the current node is a caption element, a colgroup element, a dd element, a dt element, an li element, an optgroup element, an option element, a p element, an rb element, an rp element, an rt element, an rtc element, a tbody element, a td element, a tfoot element, a th element, a thead element, or a tr element, the UA must pop the current node off the stack of open elements.
        Parameters:
        excludeTag - If a step requires the UA to generate implied end tags but lists an element to exclude from the process, then the UA must perform the above steps as if that element was not in the above list.
      • generateImpliedEndTags

        void generateImpliedEndTags()
      • generateImpliedEndTags

        void generateImpliedEndTags​(boolean thorough)
        Pops elements off the stack according to the implied end tag rules
        Parameters:
        thorough - if we are thorough (includes table elements etc) or not
      • closeElement

        void closeElement​(java.lang.String name)
      • isSpecial

        boolean isSpecial​(Element el)
      • lastFormattingElement

        Element lastFormattingElement()
      • positionOfElement

        int positionOfElement​(Element el)
      • removeLastFormattingElement

        Element removeLastFormattingElement()
      • pushActiveFormattingElements

        void pushActiveFormattingElements​(Element in)
      • pushWithBookmark

        void pushWithBookmark​(Element in,
                              int bookmark)
      • checkActiveFormattingElements

        void checkActiveFormattingElements​(Element in)
      • isSameFormattingElement

        private boolean isSameFormattingElement​(Element a,
                                                Element b)
      • reconstructFormattingElements

        void reconstructFormattingElements()
      • clearFormattingElementsToLastMarker

        void clearFormattingElementsToLastMarker()
      • removeFromActiveFormattingElements

        void removeFromActiveFormattingElements​(Element el)
      • isInActiveFormattingElements

        boolean isInActiveFormattingElements​(Element el)
      • getActiveFormattingElement

        Element getActiveFormattingElement​(java.lang.String nodeName)
      • replaceActiveFormattingElement

        void replaceActiveFormattingElement​(Element out,
                                            Element in)
      • insertMarkerToFormattingElements

        void insertMarkerToFormattingElements()
      • insertInFosterParent

        void insertInFosterParent​(Node in)
      • templateModeSize

        int templateModeSize()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • isContentForTagData

        protected boolean isContentForTagData​(java.lang.String normalName)
        Description copied from class: TreeBuilder
        (An internal method, visible for Element. For HTML parse, signals that script and style text should be treated as Data Nodes).
        Overrides:
        isContentForTagData in class TreeBuilder