|
Openfire 3.5.0 Javadoc | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jivesoftware.util.ElementUtil
public class ElementUtil
We use a simple naming convention of meta-data key names: data is stored heirarchically separated by dots. The last name may contain a colon ':' character that is read as name:attribute. For example setting X.Y.Z to someValue, would map to an XML snippet of:
<X> <Y> <Z>someValue</Z> </Y> </X>And X.Y.Z:key to anotherValue as:
<X> <Y> <Z key="anotherValue" /> </Y> </X>
Some XML cannot be built or accessed using this naming convention (e.g. a typical Roster reset packet). More complex XML packet should be represented using the XMPPDOMFragment. The Element class is designed to provide 80% of XML manipulation capabilities with the simplest 20% of code and API size making it convenient for meta-data, simple IQ packets, etc.
Method Summary | |
---|---|
static void |
deleteProperty(org.dom4j.Element element,
String name)
Deletes the specified property. |
static String[] |
getChildrenProperties(org.dom4j.Element element,
String parent)
Return all children property names of a parent property as a String array, or an empty array if the if there are no children. |
String[] |
getProperties(org.dom4j.Element element,
String name)
Return all values who's path matches the given property name as a String array, or an empty array if the if there are no children. |
static String |
getProperty(org.dom4j.Element element,
String name)
Returns the value of the specified property. |
static String[] |
getRecursiveChildrenProperties(org.dom4j.Element element,
String parent)
Returns all recursive children of the given parent property or an empty string array if no children exist. |
static boolean |
includesProperty(org.dom4j.Element element,
String name)
Returns true if the specified property is included in the XML hierarchy. |
static void |
setProperties(org.dom4j.Element element,
String name,
String[] values)
Sets a property to an array of values. |
static void |
setProperty(org.dom4j.Element element,
String name,
String value)
Sets the value of the specified property. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static String getProperty(org.dom4j.Element element, String name)
name
- the name of the property to get.
public static boolean includesProperty(org.dom4j.Element element, String name)
name
- the name of the property to find out.
public String[] getProperties(org.dom4j.Element element, String name)
<foo> <bar> <prop>some value</prop> <prop>other value</prop> <prop>last value</prop> </bar> </foo>If you call getProperties("foo.bar.prop") will return a string array containing {"some value", "other value", "last value"}.
name
- the name of the property to retrieve
public static void setProperties(org.dom4j.Element element, String name, String[] values)
<foo> <bar> <prop>some value</prop> <prop>other value</prop> <prop>last value</prop> </bar> </foo>
name
- the name of the property.values
- The array of values for the property (can be empty but not null)public static String[] getChildrenProperties(org.dom4j.Element element, String parent)
parent
- the name of the parent property.
public static String[] getRecursiveChildrenProperties(org.dom4j.Element element, String parent)
parent
- the parent property.
public static void setProperty(org.dom4j.Element element, String name, String value)
name
- the name of the property to set.value
- the new value for the property.public static void deleteProperty(org.dom4j.Element element, String name)
Deletes the specified property.
You MAY NOT use the atttribute markup (using a ':' in the last element name) with this call. deleteProperty() removes both the containing text, and the element itself along with any attributes associated with that element.
name
- the property to delete.
|
Openfire 3.5.0 Javadoc | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |