handler.recordEObject(currentNode, o,o.eContainer(), f);
handler.recordValues(currentNode, o.eContainer(), f, o);
  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;        }        if (!toDOM)        {          doc.startElement(elementName);        }        else        {          currentNode = currentNode.appendChild(document.createElementNS(helper.getNamespaceURI(prefix), elementName));          if (DEBUG_DOM)          {            System.out.println("-->"+currentNode.getNodeName()+"; eObject: "+o.eClass().getName()+"; container: "+o.eContainer().eClass().getName()+"; "+f.getName());          }          handler.recordEObject(currentNode, o, o.eContainer(), f);        }        saveElementID(o);        return;      }    }    if (map != null)    {      XMLResource.XMLInfo info = map.getInfo(eClass);      if (info != null && info.getXMLRepresentation() == XMLResource.XMLInfo.ELEMENT)      {        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);          }        }        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);        }      }    }    if (!toDOM)    {      String featureName = helper.getQName(f);      doc.startElement(featureName);    }    else    {      helper.populateNameInfo(nameInfo, f);      if (currentNode == null)      {        // this is a root element        currentNode = document.createElementNS(nameInfo.getNamespaceURI(), nameInfo.getQualifiedName());        document.appendChild(currentNode);        if (DEBUG_DOM)        {          System.out.println("-->"+currentNode.getNodeName()+"; eObject: "+o.eClass().getName()+"; container: "+o.eContainer().eClass().getName()+"; "+f.getName());        }        handler.recordEObject(currentNode, o, o.eContainer(), f);      }      else      {        currentNode = currentNode.appendChild(document.createElementNS(nameInfo.getNamespaceURI(), nameInfo.getQualifiedName()));        if (DEBUG_DOM)        {          System.out.println("-->"+currentNode.getNodeName()+"; eObject: "+o.eClass().getName()+"; container: "+o.eContainer().eClass().getName()+"; "+f.getName());        }        handler.recordEObject(currentNode, o, o.eContainer(), f);      }    }        if (eClass != eType && eClass != anyType)    {      if (eClass == anySimpleType)      {        saveTypeAttribute(((SimpleAnyType)o).getInstanceType());      }      else      {        saveTypeAttribute(eClass);      }    }    saveElementID(o);  }