*/
public Object unmarshal(Object obj, IUnmarshallingContext ictx)
throws JiBXException {
// make sure we're at the appropriate start tag
UnmarshallingContext ctx = (UnmarshallingContext)ictx;
if (!ctx.isAt(m_uri, m_name)) {
ctx.throwStartTagNameError(m_uri, m_name);
}
// create new hashmap if needed
int size = ctx.attributeInt(m_uri,
getSizeAttributeName(), DEFAULT_SIZE);
Map map = (Map)obj;
if (map == null) {
map = new HashMap(size);
}
// process all entries present in document
ctx.parsePastStartTag(m_uri, m_name);
while (ctx.isAt(m_uri, getEntryElementName())) {
Object key = ctx.attributeText(m_uri, getKeyAttributeName(), null);
ctx.parsePastStartTag(m_uri, getEntryElementName());
Object value = ctx.unmarshalElement();
map.put(key, value);
ctx.parsePastEndTag(m_uri, getEntryElementName());
}
ctx.parsePastEndTag(m_uri, m_name);
return map;
}