code: public Element workspaceToElement() {
          final Workspace space = this;
  
          final Element element = new Element("workspace", AtomService.ATOM_PROTOCOL);
  
          final Element titleElem = new Element("title", AtomService.ATOM_FORMAT);
          titleElem.setText(space.getTitle());
          if (space.getTitleType() != null && !space.getTitleType().equals("TEXT")) {
              titleElem.setAttribute("type", space.getTitleType(), AtomService.ATOM_FORMAT);
          }
          element.addContent(titleElem);
  
          for (final Collection col : space.getCollections()) {
              element.addContent(col.collectionToElement());
          }
  
          return element;
      }
docs: Serialize an AtomService.DefaultWorkspace object into an XML element