doc.endElement();
if (!toDOM) { doc.endElement(); }
  protected void endSaveFeatures(EObject o, int elementType, String content)  {    if (processElementExtensions(o))    {      if (o instanceof AnyType)      {               helper.popContext();      }      doc.endElement();    }    else    {      switch (elementType)      {        case EMPTY_ELEMENT:        {          doc.endEmptyElement();          break;        }        case CONTENT_ELEMENT:        {          doc.endContentElement(content);          break;        }        default:        {          if (o instanceof AnyType)          {                   helper.popContext();          }          doc.endElement();          break;        }      }    }  }