public class Tag extends Object
Constructor and Description |
---|
Tag(String name,
Map<String,String> attributes) |
Tag(String name,
Map<String,String> attributes,
Object... contents)
Construct a new Tag with a name.
|
Tag(String name,
Object... contents)
Construct a new Tag with a name.
|
Tag(String name,
String[] attributes) |
Tag(String name,
String[] attributes,
Object... contents)
Construct a new Tag with a name and a set of attributes.
|
Tag(Tag parent,
String name,
Object... contents) |
Modifier and Type | Method and Description |
---|---|
Tag |
addAttribute(String key,
Date value)
Add a new date attribute.
|
Tag |
addAttribute(String key,
int value)
Add a new attribute.
|
Tag |
addAttribute(String key,
Object value)
Add a new attribute.
|
Tag |
addAttribute(String key,
String value)
Add a new attribute.
|
Tag |
addContent(String string)
Add a new content string.
|
Tag |
addContent(Tag tag)
Add a new content tag.
|
String |
compact() |
static String |
escape(String s)
Escape a string, do entity conversion.
|
String |
findRecursiveAttribute(String name) |
String |
getAttribute(String key)
Return the attribute value.
|
String |
getAttribute(String key,
String deflt)
Return the attribute value or a default if not defined.
|
Map<String,String> |
getAttributes()
Answer the attributes as a Dictionary object.
|
List<Object> |
getContents()
Return the contents.
|
List<Object> |
getContents(String tag)
Return only the tags of the first level of descendants that match the
name.
|
String |
getContentsAsString()
Return the whole contents as a String (no tag info and attributes).
|
void |
getContentsAsString(StringBuilder sb)
convenient method to get the contents in a StringBuilder.
|
String |
getLocalName() |
String |
getName()
Return the name of the tag.
|
String |
getNameSpace() |
String |
getNameSpace(String name) |
String |
getString(String path) |
String |
getStringContent() |
boolean |
match(String search,
Tag child,
Tag mapping) |
Tag |
print(int indent,
PrintWriter pw)
Print the tag formatted to a PrintWriter.
|
void |
rename(String string) |
Collection<Tag> |
select(String path)
root/preferences/native/os
|
Collection<Tag> |
select(String path,
Tag mapping) |
void |
setCDATA() |
String |
toString()
Return a string representation of this Tag and all its children
recursively.
|
String |
validate() |
public static final Pattern NAME_P
public Tag(String name, Map<String,String> attributes, Object... contents)
public Tag(String name, String[] attributes, Object... contents)
public Tag addAttribute(String key, Date value)
public String getName()
public String getAttribute(String key, String deflt)
public Map<String,String> getAttributes()
public String toString()
public List<Object> getContents(String tag)
public String getContentsAsString()
public void getContentsAsString(StringBuilder sb)
public Tag print(int indent, PrintWriter pw)
public Collection<Tag> select(String path)
public Collection<Tag> select(String path, Tag mapping)
public String getStringContent()
public String getNameSpace()
public String getLocalName()
public void rename(String string)
public void setCDATA()
public String compact()
public String validate()
Copyright © 2021 aQute SARL. All rights reserved.