|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--bill.util.xml.SimpleXMLObject
Holds an object, or node, in the XML document. May have a value associated with it and may have a list of attributes associated with it.
Constructor Summary | |
SimpleXMLObject(SimpleXMLObject object)
Copy contructor. |
|
SimpleXMLObject(SimpleXMLObject object,
boolean copyChildren)
Copy contructor. |
|
SimpleXMLObject(String name)
Simple creator that just sets the object's name to the specified value. |
|
SimpleXMLObject(String name,
String value)
Simple creator that just sets the object's name and value to the specified values. |
Method Summary | |
void |
addAttribute(SimpleXMLAttribute attr)
Adds the specified attribute to the list of attributes for this object. |
void |
addAttribute(String attrName,
String attrValue)
Adds the specified attribute to the list of attributes for this object. |
void |
addChild(SimpleXMLObject child)
Adds the specified node as a child of this node. |
boolean |
equals(Object other)
Checks if two SimpleXMLObject objects are equal. |
SimpleXMLAttribute |
getAttribute(String attrName)
Retrieves the attribute object for the specified attribute name. |
Vector |
getAttributes()
Retrieves the attributes of this object. |
String |
getAttributeValue(String attrName)
Retrieves the value for the specified attribute name. |
Vector |
getChildren()
Retrieves the child objects of this object. |
static String |
getLineSeparator()
Retrieves the string that represents a line separator. |
String |
getName()
Retrieves the name of this object. |
String |
getValue()
Retrieves the value of this object. |
boolean |
isCData()
Checks to see if this object's value should be treated as CData. |
void |
mergeChildren(SimpleXMLObject source)
Adds the children of the source node to the children of this node. |
static String |
replace(String string,
String oldPattern,
String newPattern)
Replaces all instances of a pattern in a string with another pattern. |
void |
setAttributes(Vector attributes)
Sets the attribute list for this object. |
void |
setAttributesCopies(Vector attributes)
Sets the attribute list for this object, but rather than just assign the passed vector, it creates new attribute objects using the data from the passed vector. |
void |
setAttributeValue(String attrName,
String attrValue)
Adds the specified attribute to the list of attributes for this object if it does not already exist, updates the value of the attribute if it does exist. |
void |
setCData(boolean cdata)
Sets the cdata indicator the the specified value. |
void |
setName(String name)
Sets the name of this object. |
void |
setValue(String value)
Sets the value of this object. |
String |
toXML()
Dumps out the object in valid XML string representation. |
String |
toXML(boolean includeChildren)
Dumps out the object in valid XML string representation. |
SimpleXMLAttribute |
updateAttribute(String name,
String value)
Updates the value of the specified attribute. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public SimpleXMLObject(String name)
name
- The name you wish to assign to the object.public SimpleXMLObject(String name, String value)
name
- The name you wish to assign to the object.value
- The value you wish to assign to the object.public SimpleXMLObject(SimpleXMLObject object)
object
- The object to be copied.public SimpleXMLObject(SimpleXMLObject object, boolean copyChildren)
object
- The object to be copied.copyChildren
- Used to indicate if descendants should also be copied,
true
indicates they should, false
indicates they
should not.Method Detail |
public static String getLineSeparator()
public String getName()
public void setName(String name)
name
- The new name of this object.public String getValue()
public void setValue(String value)
value
- The new value of this objectpublic void setCData(boolean cdata)
true
indicates that the object's value should be treated as CData.cdata
- The value to set the CData indicator to.public boolean isCData()
true
if the value should be treated as
CData, otherwise returns false
.public Vector getChildren()
public void addChild(SimpleXMLObject child)
child
- The node to be added as a child.public void mergeChildren(SimpleXMLObject source)
source
- The node to take the children out of.public void setAttributes(Vector attributes)
attributes
- The new attribute list for this objectpublic void setAttributesCopies(Vector attributes)
attributes
- The new attribute list to copy.public Vector getAttributes()
public SimpleXMLAttribute getAttribute(String attrName)
attrName
- Name of the attribute to retrieve.null
.public String getAttributeValue(String attrName)
attrName
- Name of the attribute to retrieve.null
.public void addAttribute(String attrName, String attrValue)
attrName
- The name of the attribute to be added to the attribute
list.attrValue
- The value to assign to the new attribute.public void addAttribute(SimpleXMLAttribute attr)
attr
- The attribute to be added to the attribute list.public void setAttributeValue(String attrName, String attrValue)
attrName
- The name of the attribute to set the value of.attrValue
- The value to assign to the attribute.public SimpleXMLAttribute updateAttribute(String name, String value)
name
- The name of the attribute to update.value
- The value to set the attribute to.public String toXML()
public String toXML(boolean includeChildren)
includeChildren
- Indicates if child objects should be included in
the generated XML string, true
indicates they should,
false
indicates they should not.public static String replace(String string, String oldPattern, String newPattern)
string
- The string to perform the replacements against.oldPattern
- The pattern to be replaced in the original string.newPattern
- The pattern to replace the old pattern with.public boolean equals(Object other)
equals
in class Object
other
- The other object to check for equality.true
if the object are equal, returns
false
otherwise.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |