Package com.itextpdf.tool.xml.parser
Class XMLParserMemory
java.lang.Object
com.itextpdf.tool.xml.parser.XMLParserMemory
Wrapper class for different things that need to be kept track of between different states.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final StringBuilder
private final StringBuilder
private String
private final StringBuilder
private String
private String
private final boolean
private char
private final StringBuilder
private String
private String
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncomment()
Returns the xml comment buffer.current()
The current text buffer.void
currentAttr
(String attr) Sets the encountered attribute.Returns the current entity buffer.void
currentTag
(String content) Set the encountered tag.void
Flushes the namespace memory.Returns a map of all attributes and their value found on the current tag.Returns the current tag.Get the current namespace.boolean
true if there is a currentAttributechar
lastChar()
void
lastChar
(char c) Set the last charvoid
Sets the current namespace.Returns the xml processing instruction buffervoid
putCurrentAttrValue
(String content) Sets the current attribute value and adds the attribute (if it's not null) to the attribute map.void
Resets the ByteArrayOutputStream of this class.void
setStoredString
(String storedString) Returns last tag that needs to be taken into account for HTML Whitespace handling.
Used byInsideTagHTMLState
, only for HTML processing.void
whitespaceTag
(String tag) Sets the last tag that needs to be taken into account for HTML Whitespace handling.
Used byInsideTagHTMLState
, only for HTML processing.
-
Field Details
-
currentTag
-
currentAttr
-
currentEntity
-
comment
-
baos
-
processingInstruction
-
attr
-
wsTag
-
currentNameSpace
-
lastChar
private char lastChar -
isHtml
private final boolean isHtml -
storedString
-
-
Constructor Details
-
XMLParserMemory
public XMLParserMemory(boolean isHtml)
-
-
Method Details
-
currentTag
Set the encountered tag.- Parameters:
content
- the tag
-
currentAttr
Sets the encountered attribute.- Parameters:
attr
- the attribute
-
hasCurrentAttribute
public boolean hasCurrentAttribute()true if there is a currentAttribute- Returns:
- true or false
-
putCurrentAttrValue
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
The current text buffer.- Returns:
- current text buffer
-
getCurrentTag
Returns the current tag.- Returns:
- the currentTag
-
getAttributes
Returns a map of all attributes and their value found on the current tag.- Returns:
- the attributes of the current tag
-
currentEntity
Returns the current entity buffer.- Returns:
- a StringBuilder for the current entity
-
comment
Returns the xml comment buffer.- Returns:
- comment
-
processingInstruction
Returns the xml processing instruction buffer- Returns:
- processing instruction buffer
-
whitespaceTag
Returns last tag that needs to be taken into account for HTML Whitespace handling.
Used byInsideTagHTMLState
, only for HTML processing.- Returns:
- tag
-
whitespaceTag
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
Sets the current namespace.- Parameters:
ns
- the current namespace
-
flushNameSpace
public void flushNameSpace()Flushes the namespace memory. -
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
-
setStoredString
-