Commit 8c80171e authored by Matt Tucker's avatar Matt Tucker Committed by matt

No longer needed.


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@322 b35dd754-fafc-0310-a699-88a17e54d16e
parent d6555bcf
/**
* $RCSfile$
* $Revision$
* $Date$
*
* Copyright (C) 2004 Jive Software. All rights reserved.
*
* This software is published under the terms of the GNU Public License (GPL),
* a copy of which is included in this distribution.
*/
package org.jivesoftware.messenger;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import org.dom4j.Element;
public class MetaDataUtils {
private static final String META_DATA_NAMESPACE = "http://www.jivesoftware.com/workgroup/metadata";
private static final String META_DATA_NAME = "metadata";
private MetaDataUtils() {
}
final public static Map getMetaData(Iterator iterator) {
final XMPPDOMFragment metaData = getInfoMetaData(iterator);
return getMap(metaData);
}
private static Map getMap(XMPPDOMFragment metaData) {
final Map map = new HashMap();
Iterator items = metaData.getRootElement().element(META_DATA_NAME).elementIterator();
while (items.hasNext()) {
final Element item = (Element)items.next();
if ("value".equals(item.getName())) {
String name = item.attributeValue("name");
if (name != null) {
String value = item.getTextTrim();
map.put(name, value);
}
}
}
return map;
}
private static XMPPDOMFragment getInfoMetaData(Iterator metaDataIter) {
XMPPDOMFragment metaData = null;
while (metaDataIter.hasNext()) {
MetaDataFragment fragment = (MetaDataFragment)metaDataIter.next();
if (META_DATA_NAME.equals(fragment.getName())
&& META_DATA_NAMESPACE.equals(fragment.getNamespace())) {
metaData = fragment.convertToDOMFragment();
break;
}
}
return metaData;
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment