doc.addAttribute(XMIResource.HREF, helper.getHREF(value));
doc.addAttribute(XMLResource.HREF, helper.getHREF(value));
  public Object writeTopObjects(List contents)  {    doc.startElement(XMI_TAG_NS);    Object mark = doc.mark();    for (int i = 0, size = contents.size(); i < size; i++)    {      EObject top = (EObject)contents.get(i);      EClass eClass = top.eClass();      if (eClass == EcorePackage.eINSTANCE.getEAnnotation())      {        EAnnotation annotation = (EAnnotation)top;        if (!annotation.getSource().equals(EMOFExtendedMetaData.EMOF_PACKAGE_NS_URI)) continue;        doc.startElement(EMOFExtendedMetaData.EMOF_TAG);        doc.addAttribute(idAttributeName, helper.getID(annotation));        doc.addAttribute(EMOFExtendedMetaData.EMOF_TAG_NAME, (String)annotation.getDetails().get(EMOFExtendedMetaData.EMOF_TAG_NAME));        doc.addAttribute(EMOFExtendedMetaData.EMOF_TAG_VALUE, (String)annotation.getDetails().get(EMOFExtendedMetaData.EMOF_TAG_VALUE));        InternalEList values = (InternalEList)annotation.getReferences();        if (!values.isEmpty())        {          if (sameDocMany(annotation, EcorePackage.eINSTANCE.getEAnnotation_References()) == CROSS_DOC)          {            for (Iterator iter = values.basicIterator(); iter.hasNext(); )            {              EObject value = (EObject)iter.next();              doc.startElement(EMOFExtendedMetaData.EMOF_TAG_ELEMENT);              doc.addAttribute(XMIResource.HREF, helper.getHREF(value));              doc.endEmptyElement();            }          }          else          {            StringBuffer ids = new StringBuffer();            for (Iterator iter = values.basicIterator();; )            {              EObject value = (EObject)iter.next();              ids.append(helper.getIDREF(value));              if (!iter.hasNext()) break;              ids.append(" ");            }            doc.addAttribute(EMOFExtendedMetaData.EMOF_TAG_ELEMENT, ids.toString());          }        }        doc.endElement();      }      else      {        String name = helper.getQName(eClass);        doc.startElement(name);        saveElementID(top);      }    }    doc.endElement();    return mark;  }