public class TagParser
extends java.lang.Object
TagParser
parses one JETT XML tag, either a begin tag or an
end tag, including the tag namespace (if any), the tag name, and any
attributes.Modifier and Type | Field | Description |
---|---|---|
static java.lang.String |
BEGIN_END_TAG |
Determines the beginning of an XML end tag.
|
static java.lang.String |
BEGIN_START_TAG |
Determines the beginning of an XML start tag.
|
static java.lang.String |
END_BODILESS_TAG |
Determines the ending of an XML start tag that is bodiless.
|
static java.lang.String |
END_TAG |
Determines the ending of an XML start tag with a body.
|
Constructor | Description |
---|---|
TagParser(org.apache.poi.ss.usermodel.Cell cell) |
Create a
TagParser object that will parse the given tag text. |
TagParser(org.apache.poi.ss.usermodel.Cell cell,
int startIdx) |
Create a
TagParser object that will parse the given tag
text, starting at the given position in the string.. |
Modifier and Type | Method | Description |
---|---|---|
int |
getAfterTagIdx() |
Returns the 0-based index into the cell text that is after the tag.
|
java.util.Map<java.lang.String,org.apache.poi.ss.usermodel.RichTextString> |
getAttributes() |
Returns a
Map of attribute names mapped to attribute values,
possibly empty. |
org.apache.poi.ss.usermodel.Cell |
getCell() |
Returns the
Cell whose tag text is being parsed. |
java.lang.String |
getNamespace() |
Returns the namespace found, if any.
|
java.lang.String |
getNamespaceAndTagName() |
Returns a formatted string containing the namespace, followed by a colon
(if the namespace exists), followed by the tag name, e.g.
|
java.lang.String |
getTagName() |
Returns the tag name found, if any.
|
java.lang.String |
getTagText() |
Returns the portion of the cell text that is the tag text.
|
boolean |
isBodiless() |
Returns whether this tag is bodiless.
|
boolean |
isEndTag() |
Returns whether this tag is the end of the tag or not.
|
boolean |
isTag() |
Returns whether the given tag text is in fact a tag.
|
void |
parse() |
Parses the tag text.
|
void |
setCellText(java.lang.String tagText) |
Sets the tag text to the given tag text and resets the parser.
|
public static final java.lang.String BEGIN_START_TAG
public static final java.lang.String BEGIN_END_TAG
public static final java.lang.String END_TAG
public static final java.lang.String END_BODILESS_TAG
public TagParser(org.apache.poi.ss.usermodel.Cell cell)
TagParser
object that will parse the given tag text.cell
- The Cell
that contains text of the tag.public TagParser(org.apache.poi.ss.usermodel.Cell cell, int startIdx)
TagParser
object that will parse the given tag
text, starting at the given position in the string..cell
- The Cell
that contains text of the tag.startIdx
- The 0-based index into the string.public void setCellText(java.lang.String tagText)
tagText
- The new tag text.public void parse()
public boolean isTag()
BEGIN_START_TAG
or
BEGIN_END_TAG
and ends with END_TAG
.true
if the tag text represents a tag,
false
otherwise.BEGIN_START_TAG
,
BEGIN_END_TAG
,
END_TAG
public boolean isEndTag()
BEGIN_END_TAG
.true
if the tag text represents an end tag,
false
if the tag text represents a start tag.BEGIN_START_TAG
,
BEGIN_END_TAG
public boolean isBodiless()
END_BODILESS_TAG
.true
if the tag text represents an end tag,
false
if the tag text represents a start tag.END_TAG
,
END_BODILESS_TAG
public java.lang.String getNamespace()
<namespace:tagname ...>
null
if missing.public java.lang.String getTagName()
<namespace:tagname ...>
or <tagname ...>
.public java.lang.String getNamespaceAndTagName()
getNamespace() + ":" + getTagName()
.public java.util.Map<java.lang.String,org.apache.poi.ss.usermodel.RichTextString> getAttributes()
Map
of attribute names mapped to attribute values,
possibly empty.
E.g.<namespace:tagname attr1="value1" attr2="value2">
is returned as ["attr1"=>"value1", "attr2"=>"value2"]
.Map
of attribute names and attribute values.public org.apache.poi.ss.usermodel.Cell getCell()
Cell
whose tag text is being parsed.Cell
.public java.lang.String getTagText()
public int getAfterTagIdx()
Copyright © 2012–2018 Jett Team. All rights reserved.