Class XMLParserMemory


  • public class XMLParserMemory
    extends java.lang.Object
    Wrapper class for different things that need to be kept track of between different states.
    • Constructor Summary

      Constructors 
      Constructor Description
      XMLParserMemory​(boolean isHtml)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.StringBuilder comment()
      Returns the xml comment buffer.
      java.lang.StringBuilder current()
      The current text buffer.
      void currentAttr​(java.lang.String attr)
      Sets the encountered attribute.
      java.lang.StringBuilder currentEntity()
      Returns the current entity buffer.
      void currentTag​(java.lang.String content)
      Set the encountered tag.
      void flushNameSpace()
      Flushes the namespace memory.
      java.util.Map<java.lang.String,​java.lang.String> getAttributes()
      Returns a map of all attributes and their value found on the current tag.
      java.lang.String getCurrentTag()
      Returns the current tag.
      java.lang.String getNameSpace()
      Get the current namespace.
      java.lang.String getStoredString()  
      boolean hasCurrentAttribute()
      true if there is a currentAttribute
      char lastChar()  
      void lastChar​(char c)
      Set the last char
      void namespace​(java.lang.String ns)
      Sets the current namespace.
      java.lang.StringBuilder processingInstruction()
      Returns the xml processing instruction buffer
      void putCurrentAttrValue​(java.lang.String content)
      Sets the current attribute value and adds the attribute (if it's not null) to the attribute map.
      void resetBuffer()
      Resets the ByteArrayOutputStream of this class.
      void setStoredString​(java.lang.String storedString)  
      java.lang.String whitespaceTag()
      Returns last tag that needs to be taken into account for HTML Whitespace handling.
      Used by InsideTagHTMLState, only for HTML processing.
      void whitespaceTag​(java.lang.String tag)
      Sets the last tag that needs to be taken into account for HTML Whitespace handling.
      Used by InsideTagHTMLState, only for HTML processing.
      • Methods inherited from class java.lang.Object

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

      • currentTag

        private java.lang.String currentTag
      • currentAttr

        private java.lang.String currentAttr
      • currentEntity

        private final java.lang.StringBuilder currentEntity
      • comment

        private final java.lang.StringBuilder comment
      • baos

        private final java.lang.StringBuilder baos
      • processingInstruction

        private final java.lang.StringBuilder processingInstruction
      • attr

        private final java.util.Map<java.lang.String,​java.lang.String> attr
      • wsTag

        private java.lang.String wsTag
      • currentNameSpace

        private java.lang.String currentNameSpace
      • lastChar

        private char lastChar
      • isHtml

        private final boolean isHtml
      • storedString

        private java.lang.String storedString
    • Constructor Detail

      • XMLParserMemory

        public XMLParserMemory​(boolean isHtml)
    • Method Detail

      • currentTag

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

        public void currentAttr​(java.lang.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​(java.lang.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 java.lang.StringBuilder current()
        The current text buffer.
        Returns:
        current text buffer
      • getCurrentTag

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

        public java.util.Map<java.lang.String,​java.lang.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 java.lang.StringBuilder currentEntity()
        Returns the current entity buffer.
        Returns:
        a StringBuilder for the current entity
      • comment

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

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

        public java.lang.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​(java.lang.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​(java.lang.String ns)
        Sets the current namespace.
        Parameters:
        ns - the current namespace
      • flushNameSpace

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

        public java.lang.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 java.lang.String getStoredString()
      • setStoredString

        public void setStoredString​(java.lang.String storedString)