String elementName = helper.getQName(eClass); doc.startElement(elementName);
if (!toDOM) { String elementName = helper.getQName(eClass); doc.startElement(elementName); } else { helper.populateNameInfo(nameInfo, eClass); if (currentNode == null) { currentNode = document.createElementNS(nameInfo.getNamespaceURI(), nameInfo.getQualifiedName()); document.appendChild(currentNode); handler.recordEObject(currentNode, o,o.eContainer(), f); } else { currentNode = currentNode.appendChild(document.createElementNS(nameInfo.getNamespaceURI(), nameInfo.getQualifiedName())); handler.recordEObject(currentNode, o, o.eContainer(), f); } }
  protected void saveElement(EObject o, EStructuralFeature f)  {    EClass eClass = o.eClass();    EClassifier eType = f.getEType();    if (extendedMetaData != null && eClass != eType)    {      // Check if it's an anonymous type.      //      String name = extendedMetaData.getName(eClass);      if (name.endsWith("_._type"))      {        String elementName = name.substring(0, name.indexOf("_._"));        String prefix = helper.getPrefix(eClass.getEPackage());        if (!"".equals(prefix))        {          elementName = prefix + ":" + elementName;        }        doc.startElement(elementName);        saveElementID(o);        return;      }    }    if (map != null)    {      XMLResource.XMLInfo info = map.getInfo(eClass);      if (info != null && info.getXMLRepresentation() == XMLResource.XMLInfo.ELEMENT)      {        String elementName = helper.getQName(eClass);        doc.startElement(elementName);        saveElementID(o);        return;      }    }    if (o instanceof AnyType)    {      helper.pushContext();      for (Iterator i = ((AnyType)o).getAnyAttribute().iterator(); i.hasNext(); )      {        FeatureMap.Entry entry = (FeatureMap.Entry)i.next();        if (ExtendedMetaData.XMLNS_URI.equals(extendedMetaData.getNamespace(entry.getEStructuralFeature())))        {          String uri = (String)entry.getValue();          helper.addPrefix(extendedMetaData.getName(entry.getEStructuralFeature()), uri == null ? "" : uri);        }      }    }        String featureName = helper.getQName(f);    doc.startElement(featureName);        if (eClass != eType && eClass != anyType)    {      if (eClass == anySimpleType)      {        saveTypeAttribute(((SimpleAnyType)o).getInstanceType());      }      else      {        saveTypeAttribute(eClass);      }    }    saveElementID(o);  }