|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectaQute.lib.tag.Tag
public class Tag
The Tag class represents a minimal XML tree. It consist of a named element with a hashtable of named attributes. Methods are provided to walk the tree and get its constituents. The content of a Tag is a list that contains String objects or other Tag objects.
Constructor Summary | |
---|---|
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)
|
Method Summary | |
---|---|
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 |
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(StringBuffer sb)
convenient method to get the contents in a StringBuffer. |
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Tag(String name, Object... contents)
public Tag(Tag parent, String name, Object... contents)
public Tag(String name, Map<String,String> attributes, Object... contents)
public Tag(String name, Map<String,String> attributes)
public Tag(String name, String[] attributes, Object... contents)
public Tag(String name, String[] attributes)
Method Detail |
---|
public Tag addAttribute(String key, String value)
public Tag addAttribute(String key, Object value)
public Tag addAttribute(String key, int value)
public Tag addAttribute(String key, Date value)
public Tag addContent(String string)
public Tag addContent(Tag tag)
public String getName()
public String getAttribute(String key)
public String getAttribute(String key, String deflt)
public Map<String,String> getAttributes()
public List<Object> getContents()
public String toString()
toString
in class Object
public List<Object> getContents(String tag)
public String getContentsAsString()
public void getContentsAsString(StringBuffer sb)
public Tag print(int indent, PrintWriter pw)
public Collection<Tag> select(String path)
public Collection<Tag> select(String path, Tag mapping)
public boolean match(String search, Tag child, Tag mapping)
public String getString(String path)
public String getStringContent()
public String getNameSpace()
public String getNameSpace(String name)
public String findRecursiveAttribute(String name)
public String getLocalName()
public void rename(String string)
public void setCDATA()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |