public void serializeBody(BeanT o, XMLSerializer w, Object outerPeer)
      throws SAXException, AccessorException, IOException, XMLStreamException {
    ValueT v = acc.get(o);
    if (v != null) {
      bareStartTag(w, tagName, v);
      for (Map.Entry e : (Set<Map.Entry>) v.entrySet()) {
        bareStartTag(w, entryTag, null);

        Object key = e.getKey();
        if (key != null) {
          w.startElement(keyTag, key);
          w.childAsXsiType(key, fieldName, keyBeanInfo, false);
          w.endElement();
        }

        Object value = e.getValue();
        if (value != null) {
          w.startElement(valueTag, value);
          w.childAsXsiType(value, fieldName, valueBeanInfo, false);
          w.endElement();
        }

        w.endElement();
      }
      w.endElement();
    } else if (nillable) {
      w.startElement(tagName, null);
      w.writeXsiNilTrue();
      w.endElement();
    }
  }
 @Override
 public void leaveElement(State state, TagName ea) throws SAXException {
   super.leaveElement(state, ea);
   try {
     acc.set(target, map);
   } catch (AccessorException ex) {
     handleGenericException(ex, true);
   }
 }
 @Override
 public void startElement(UnmarshallingContext.State state, TagName ea) throws SAXException {
   // create or obtain the Map object
   try {
     target = (BeanT) state.prev.target;
     map = acc.get(target);
     if (map == null) {
       map = ClassFactory.create(mapImplClass);
     }
     map.clear();
     state.target = map;
   } catch (AccessorException e) {
     // recover from error by setting a dummy Map that receives and discards the values
     handleGenericException(e, true);
     state.target = new HashMap();
   }
 }
 public void reset(BeanT bean) throws AccessorException {
   acc.set(bean, null);
 }