com.itextpdf.tool.xml.parser
Class XMLParserMemory

java.lang.Object
  extended by com.itextpdf.tool.xml.parser.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 Summary
XMLParserMemory(boolean isHtml)
           
 
Method Summary
 StringBuilder comment()
          Returns the xml comment buffer.
 StringBuilder current()
          The current text buffer.
 void currentAttr(String attr)
          Sets the encountered attribute.
 StringBuilder currentEntity()
          Returns the current entity buffer.
 void currentTag(String content)
          Set the encountered tag.
 void flushNameSpace()
          Flushes the namespace memory.
 Map<String,String> getAttributes()
          Returns a map of all attributes and their value found on the current tag.
 String getCurrentTag()
          Returns the current tag.
 String getNameSpace()
          Get the current namespace.
 boolean hasCurrentAttribute()
          true if there is a currentAttribute
 char lastChar()
           
 void lastChar(char c)
          Set the last char
 void namespace(String ns)
          Sets the current namespace.
 void putCurrentAttrValue(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.
 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(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
 

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

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.


Copyright © 2012. All Rights Reserved.