code: public void write(EntityType type) throws ODataRenderException {
  
          LOG.debug("Writing type {} of type {}", type.getName(), type.getMetaType());
          try {
              xmlWriter.writeStartElement(ENTITY_TYPE);
              if (!isNullOrEmpty(type.getBaseTypeName())) {
                  xmlWriter.writeAttribute(BASE_TYPE, type.getBaseTypeName());
              }
              if (type.isOpen()) {
                  xmlWriter.writeAttribute(OPEN_TYPE, Boolean.toString(type.isOpen()));
              }
              if (type.hasStream()) {
                  xmlWriter.writeAttribute(HAS_STREAM, Boolean.toString(type.hasStream()));
              }
              xmlWriter.writeAttribute(NAME, type.getName());
              if (type.isAbstract()) {
                  xmlWriter.writeAttribute(ABSTRACT, "true");
              }
              xmlWriter.writeStartElement(ENTITY_TYPE_KEY);
              for (PropertyRef propertyRef : type.getKey().getPropertyRefs()) {
                  xmlWriter.writeStartElement(PROPERTY_REF);
                  xmlWriter.writeAttribute(NAME, propertyRef.getPath());
                  xmlWriter.writeEndElement();
              }
              xmlWriter.writeEndElement();
  
              visitProperties(entityDataModel, type, property -> {
                  try {
                      propertyWriter.write(property);
                  } catch (XMLStreamException e) {
                      throw new ODataRenderException("Error while writing property: " + property.getName(), e);
                  }
              });
              xmlWriter.writeEndElement();
          } catch (XMLStreamException e) {
              throw new ODataRenderException("Error while writing entity type: " + type.getName(), e);
          }
  
      }
docs: Write an {@code <EntityType>} element for the given {@code EntityType}.
  
  @param type The given entity type. It can not be {@code null}.
  @throws ODataRenderException if unable to render