code: public static Metadata fromXml(Document domainXml) {
          try {
              SimpleDateFormat sdf = new SimpleDateFormat(XML_DATE_FORMAT);
              Element metadata = getMetadataElement(domainXml);
              if (metadata == null) {
                  return null;
              }
              Namespace ns = Namespace.getNamespace(METADATA_NS_V1);
              Element ocMetadata = metadata.getChild(OVERCAST_METADATA, ns);
              if (ocMetadata == null) {
                  return null;
              }
              String parentDomain = getElementText(ocMetadata, PARENT_DOMAIN, ns);
              String creationTime = getElementText(ocMetadata, CREATION_TIME, ns);
              Date date = sdf.parse(creationTime);
  
              if(ocMetadata.getChild(PROVISIONED_WITH, ns) != null) {
                  String provisionedWith = getElementText(ocMetadata, PROVISIONED_WITH, ns);
                  String checkSum = getElementText(ocMetadata, PROVISIONED_CHECKSUM, ns);
  
                  return new Metadata(parentDomain, provisionedWith, checkSum, date);
              }
              return new Metadata(parentDomain, date);
          } catch (ParseException e) {
              throw new IllegalArgumentException("Invalid date in metadata on domain", e);
          }
      }
docs: Extract {@link Metadata} from the domain XML. Throws {@link IllegalArgumentException} if the metadata is
  malformed.
  
  @return the metadata or <code>null</code> if there's no metadata