public static String getProperty(Element element, String name) {
        String value = null;
        String[] propName = parsePropertyName(name);

        // Grab the attribute if there is one
        String lastName = propName[propName.length - 1];
        String attName = null;
        int attributeIndex = lastName.indexOf(':');
        if (attributeIndex >= 0) {
            propName[propName.length - 1] = lastName.substring(0, attributeIndex);
            attName = lastName.substring(attributeIndex + 1);
        }

        // Search for this property by traversing down the XML hierarchy.
        int i = propName[0].equals(element.getName()) ? 1 : 0;
        for (; i < propName.length; i++) {
            element = element.element(propName[i]);
            if (element == null) {
                break;
            }
        }
        if (element != null) {
            if (attName == null) {
                value = element.getTextTrim();
            }
            else {
                value = element.attributeValue(attName);
            }
        }

        return value;
    }
Returns the value of the specified property. A {@code null} answer does not necessarily mean
that the property does not exist.

@param element the element from which the property should be retrieved
@param name the name of the property to get.
@return the value of the specified property.
xmppserver/src/main/java/org/jivesoftware/util/ElementUtil.java