public class XmlTag extends Object
Modifier and Type | Class and Description |
---|---|
static class |
XmlTag.TagType
Enumerated type for different kinds of component tags.
|
Constructor and Description |
---|
XmlTag()
Construct.
|
XmlTag(org.apache.wicket.markup.parser.XmlTag.TextSegment text,
XmlTag.TagType type)
Construct.
|
Modifier and Type | Method and Description |
---|---|
boolean |
closes(XmlTag open)
Gets whether this tag closes the provided open tag.
|
boolean |
equalTo(XmlTag element) |
CharSequence |
getAttribute(String key)
Get a string attribute.
|
IValueMap |
getAttributes()
Gets a hashmap of this tag's attributes.
|
int |
getColumnNumber()
Get the column number.
|
int |
getLength()
Gets the length of the tag in characters.
|
int |
getLineNumber()
Get the line number.
|
String |
getName()
Gets the name of the tag, for example the tag
<b> 's name would be 'b'. |
String |
getNamespace()
Namespace of the tag, if available.
|
XmlTag |
getOpenTag()
Assuming this is a close tag, return the corresponding open tag
|
int |
getPos()
Gets the location of the tag in the input string.
|
XmlTag.TagType |
getType()
Get the tag type.
|
boolean |
hasAttributes() |
boolean |
isClose()
Gets whether this is a close tag.
|
boolean |
isMutable() |
boolean |
isOpen()
Gets whether this is an open tag.
|
boolean |
isOpenClose()
Gets whether this tag is an open/ close tag.
|
XmlTag |
makeImmutable()
Makes this tag object immutable by making the attribute map unmodifiable.
|
XmlTag |
mutable()
Gets this tag if it is already mutable, or a mutable copy of this tag if it is immutable.
|
Object |
put(String key,
boolean value)
Puts a boolean attribute.
|
Object |
put(String key,
CharSequence value)
Puts a string attribute.
|
Object |
put(String key,
int value)
Puts an int attribute.
|
Object |
put(String key,
StringValue value)
Puts a
StringValue attribute. |
void |
putAll(Map<String,Object> map)
Puts all attributes in map
|
void |
remove(String key)
Removes an attribute.
|
void |
setName(String name)
Sets the tag name.
|
void |
setNamespace(String namespace)
Sets the tag namespace.
|
void |
setOpenTag(XmlTag tag)
Assuming this is a close tag, assign it's corresponding open tag.
|
void |
setType(XmlTag.TagType type)
Sets type of this tag if it is not immutable.
|
CharSequence |
toCharSequence() |
String |
toDebugString()
Converts this object to a string representation.
|
String |
toString()
Converts this object to a string representation.
|
String |
toUserDebugString()
String representation with line and column number
|
CharSequence |
toXmlString(String attributeToBeIgnored)
Assuming some attributes have been changed, toXmlString() rebuilds the String on based on the
tags informations.
|
public XmlTag()
public XmlTag(org.apache.wicket.markup.parser.XmlTag.TextSegment text, XmlTag.TagType type)
text
- type
- public final boolean closes(XmlTag open)
open
- The open tagpublic final boolean equalTo(XmlTag element)
element
- public IValueMap getAttributes()
public boolean hasAttributes()
public int getColumnNumber()
public int getLength()
public int getLineNumber()
public String getName()
<b>
's name would be 'b'.public String getNamespace()
public final XmlTag getOpenTag()
public int getPos()
public CharSequence getAttribute(String key)
key
- The keypublic XmlTag.TagType getType()
public boolean isClose()
public final boolean isMutable()
public boolean isOpen()
public boolean isOpenClose()
public XmlTag makeImmutable()
public XmlTag mutable()
public Object put(String key, boolean value)
key
- The keyvalue
- The valuepublic Object put(String key, int value)
key
- The keyvalue
- The valuepublic Object put(String key, CharSequence value)
key
- The keyvalue
- The valuepublic Object put(String key, StringValue value)
StringValue
attribute.key
- The keyvalue
- The valuepublic void putAll(Map<String,Object> map)
map
- A key/value mappublic void remove(String key)
key
- The key to removepublic void setName(String name)
name
- New tag namepublic void setNamespace(String namespace)
namespace
- New tag namepublic void setOpenTag(XmlTag tag)
tag
- the open-tagRuntimeException
- if 'this' is not a close tagpublic void setType(XmlTag.TagType type)
type
- The new typepublic String toDebugString()
public String toString()
public CharSequence toCharSequence()
public String toUserDebugString()
public CharSequence toXmlString(String attributeToBeIgnored)
attributeToBeIgnored
- Copyright © 2006–2016 Apache Software Foundation. All rights reserved.