docs: public void generate() throws IOException {
          final Document doc = DocumentFactory.getInstance().createDocument();
          final Element root = doc.addElement("project");
          //iterate through entities in correct order
          for (final ResourceXMLParser.Entity entity : entities) {
              if (NODE_ENTITY_TAG.equals(entity.getResourceType())) {
                  final Element ent = genEntityCommon(root, entity);
                  genNode(ent, entity);
              }
          }
  
          if (null != file) {
              FileOutputStream out=new FileOutputStream(file);
              try{
                  serializeDocToStream(out, doc);
              }finally{
                  out.close();
              }
          } else if (null != output) {
              serializeDocToStream(output, doc);
          }
      }