@Override
  public void save(OutputStream out) {
    DocumentBuilder builder;
    try {
      builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
      Document document = builder.newDocument();

      Element rootElement = document.createElement(ELEMENT_LIBRARY);
      document.appendChild(rootElement);

      rootElement.setAttribute(ATTRIBUTE_CLASS, this.getClass().getCanonicalName());
      rootElement.setAttribute(ATTRIBUTE_NAME, name);
      rootElement.setAttribute(ATTRIBUTE_NAMESPACE_ID, namespaceIdentifier);
      rootElement.setAttribute(ATTRIBUTE_NAMESPACE, namespaceName);
      rootElement.setAttribute(ATTRIBUTE_VERSION, version.getLongVersion());

      XMLTools.addTag(rootElement, ELEMENT_SYNOPSIS, synopsis);
      XMLTools.addTag(rootElement, ELEMENT_DOCUMENTATION, documentation);

      writeXML(rootElement);

      XMLTools.stream(document, out, null);
    } catch (ParserConfigurationException e) {
      // TODO
      e.printStackTrace();
    } catch (XMLException e) {
      e.printStackTrace();
      // TODO
    }
  }
 @Override
 public int compareTo(VersionNumber o) {
   int index = Double.compare(this.majorNumber, o.majorNumber);
   if (index != 0) {
     return index;
   } else {
     index = Double.compare(this.minorNumber, o.minorNumber);
     if (index != 0) {
       return index;
     } else {
       index = Double.compare(this.patchLevel, o.patchLevel);
       if (index != 0) {
         return index;
       }
       // prefer release versions over development builds
       return Boolean.compare(!isDevelopmentBuild(), !o.isDevelopmentBuild());
     }
   }
 }