Package com.itextpdf.tool.xml.parser
Class XMLParserMemory
- java.lang.Object
-
- com.itextpdf.tool.xml.parser.XMLParserMemory
-
public class XMLParserMemory extends java.lang.ObjectWrapper class for different things that need to be kept track of between different states.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<java.lang.String,java.lang.String>attrprivate java.lang.StringBuilderbaosprivate java.lang.StringBuildercommentprivate java.lang.StringcurrentAttrprivate java.lang.StringBuildercurrentEntityprivate java.lang.StringcurrentNameSpaceprivate java.lang.StringcurrentTagprivate booleanisHtmlprivate charlastCharprivate java.lang.StringBuilderprocessingInstructionprivate java.lang.StringstoredStringprivate java.lang.StringwsTag
-
Constructor Summary
Constructors Constructor Description XMLParserMemory(boolean isHtml)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringBuildercomment()Returns the xml comment buffer.java.lang.StringBuildercurrent()The current text buffer.voidcurrentAttr(java.lang.String attr)Sets the encountered attribute.java.lang.StringBuildercurrentEntity()Returns the current entity buffer.voidcurrentTag(java.lang.String content)Set the encountered tag.voidflushNameSpace()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.StringgetCurrentTag()Returns the current tag.java.lang.StringgetNameSpace()Get the current namespace.java.lang.StringgetStoredString()booleanhasCurrentAttribute()true if there is a currentAttributecharlastChar()voidlastChar(char c)Set the last charvoidnamespace(java.lang.String ns)Sets the current namespace.java.lang.StringBuilderprocessingInstruction()Returns the xml processing instruction buffervoidputCurrentAttrValue(java.lang.String content)Sets the current attribute value and adds the attribute (if it's not null) to the attribute map.voidresetBuffer()Resets the ByteArrayOutputStream of this class.voidsetStoredString(java.lang.String storedString)java.lang.StringwhitespaceTag()Returns last tag that needs to be taken into account for HTML Whitespace handling.
Used byInsideTagHTMLState, only for HTML processing.voidwhitespaceTag(java.lang.String tag)Sets the last tag that needs to be taken into account for HTML Whitespace handling.
Used byInsideTagHTMLState, only for HTML processing.
-
-
-
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
-
-
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 byInsideTagHTMLState, 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 byInsideTagHTMLState, 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)
-
-