public class Tag extends Object
Modifier and Type | Field and Description |
---|---|
static int |
CONTINUE_TAG_EVALUATION
Continue tag evaluation.
|
static Tag |
EMPTY_TAG
Empty tag.
|
static int |
SKIP_TAG
Skip tag.
|
Constructor and Description |
---|
Tag(String namespace,
String name,
Map<String,String> attributes)
Constructs a Tag with given namespace, name and attributes.
|
Tag(String namespace,
String name,
Map<String,String> attributes,
AttributeValueDelimiter attributeValueDelimiter)
Constructs a Tag with given namespace, name and attributes.
|
Modifier and Type | Method and Description |
---|---|
String |
getAttribute(String attributeName,
String defaultValue)
Get the value of an attribute, or the defaultValue if the attribute is not present.
|
Map<String,String> |
getAttributes()
All attributes for this tag, only present if the tag is (also) a start tag.
|
AttributeValueDelimiter |
getAttributeValueDelimiter()
Attribute delimiter of the tag.
|
Tag |
getEnclosingTag()
Returns enclosing Tag of this Tag, if present.
|
TagHandlerBase |
getHandler()
Returns the instance of associated
TagHandlerBase , if available. |
String |
getName()
Name of the tag without the namespace.
|
String |
getNamespace()
Namespace of the tag.
|
String |
getQualifiedName()
Returns the fully qualified name of this tag, that is namespace:name.
|
boolean |
hasAttribute(String attributeName)
Check if an attribute is present.
|
boolean |
hasEnclosingTag()
Returns a boolean value indicating whether current Tag instance has any enclosing Tag.
|
boolean |
isSameNameSpace(Tag tag)
Check if the namespace of a tag matches this tags namespace.
|
boolean |
isSameTag(Tag tag)
Check if the passed tag has the same name and namespace as this tag.
|
String |
toString()
Note, for debugging / displaying only, output format may change.
|
public static final int CONTINUE_TAG_EVALUATION
public static final int SKIP_TAG
public static final Tag EMPTY_TAG
public Tag(String namespace, String name, Map<String,String> attributes)
namespace
- name space in which the tag livesname
- name of this tagattributes
- attributes defined for the tag. May be nullpublic Tag(String namespace, String name, Map<String,String> attributes, AttributeValueDelimiter attributeValueDelimiter)
namespace
- name space in which the tag livesname
- name of this tagattributes
- attributes defined for the tag. May be nullattributeValueDelimiter
- attributes delimiter for the tag. If null will be double quote.public TagHandlerBase getHandler()
TagHandlerBase
, if available. Otherwise it returns an instance
of DefaultTagHandler
, which is the default value.
Note that, this relationship between this Tag
and its associated TagHandlerBase
is
established during transformation (processing or rendering) phase. Before that, invoking this
method would return a DefaultTagHandler.
public Tag getEnclosingTag()
Note that, this relationship between this Tag
and its enclosing Tag
is
established during transformation (processing or rendering) phase.
If current Tag instance does not have any enclosing Tag, invoking this
method throws IllegalStateException.
Please use hasEnclosingTag()
to figure out if current Tag has any enclosing Tag.
IllegalStateException
- if current Tag does not have any enclosing Tag.public boolean hasEnclosingTag()
true
if it has, otherwise false.public String getName()
public String getNamespace()
public AttributeValueDelimiter getAttributeValueDelimiter()
public Map<String,String> getAttributes()
public String getAttribute(String attributeName, String defaultValue)
attributeName
- name of the attributedefaultValue
- value to return if the attribute has no valuepublic boolean hasAttribute(String attributeName)
attributeName
- name of the attributepublic String getQualifiedName()
public boolean isSameTag(Tag tag)
tag
- tag to check againstpublic boolean isSameNameSpace(Tag tag)
tag
- tag to check againstCopyright (c) 2014-2021 All Rights Reserved by the RWS Group for and on behalf of its affiliates and subsidiaries