Class XMLParserMemory


  • public class XMLParserMemory
    extends Object
    Wrapper class for different things that need to be kept track of between different states.
    Author:
    redlab_b
    • Constructor Detail

      • XMLParserMemory

        public XMLParserMemory​(boolean isHtml)
    • Method Detail

      • currentTag

        public void currentTag​(String content)
        Set the encountered tag.
        Parameters:
        content - the tag
      • currentAttr

        public void currentAttr​(String attr)
        Sets the encountered attribute.
        Parameters:
        attr - the attribute
      • hasCurrentAttribute

        public boolean hasCurrentAttribute()
        true if there is a currentAttribute
        Returns:
        true or false
      • putCurrentAttrValue

        public void putCurrentAttrValue​(String content)
        Sets the current attribute value and adds the attribute (if it's not null) to the attribute map.
        Parameters:
        content - the current attributes value.
      • current

        public StringBuilder current()
        The current text buffer.
        Returns:
        current text buffer
      • getCurrentTag

        public String getCurrentTag()
        Returns the current tag.
        Returns:
        the currentTag
      • getAttributes

        public Map<String,​String> getAttributes()
        Returns a map of all attributes and their value found on the current tag.
        Returns:
        the attributes of the current tag
      • currentEntity

        public StringBuilder currentEntity()
        Returns the current entity buffer.
        Returns:
        a StringBuilder for the current entity
      • comment

        public StringBuilder comment()
        Returns the xml comment buffer.
        Returns:
        comment
      • processingInstruction

        public StringBuilder processingInstruction()
        Returns the xml processing instruction buffer
        Returns:
        processing instruction buffer
      • whitespaceTag

        public String whitespaceTag()
        Returns last tag that needs to be taken into account for HTML Whitespace handling.
        Used by InsideTagHTMLState, only for HTML processing.
        Returns:
        tag
      • whitespaceTag

        public void whitespaceTag​(String tag)
        Sets the last tag that needs to be taken into account for HTML Whitespace handling.
        Used by InsideTagHTMLState, only for HTML processing.
        Parameters:
        tag - the tag
      • namespace

        public void namespace​(String ns)
        Sets the current namespace.
        Parameters:
        ns - the current namespace
      • flushNameSpace

        public void flushNameSpace()
        Flushes the namespace memory.
      • getNameSpace

        public String getNameSpace()
        Get the current namespace.
        Returns:
        the current namespace or empty String if no namespace
      • resetBuffer

        public void resetBuffer()
        Resets the ByteArrayOutputStream of this class.
      • lastChar

        public void lastChar​(char c)
        Set the last char
        Parameters:
        c - the char
      • lastChar

        public char lastChar()
        Returns:
        the last char parameter.
      • getStoredString

        public String getStoredString()
      • setStoredString

        public void setStoredString​(String storedString)