appendLink(buffer, "http://webfinger.net/rel/profile-page", "http://xri2xrd.net/" + canonical, "text/html");
appendLink(buffer, "describedby", "http://xri2xrd.net/" + canonical, "text/html");
for (int i=0; i<xrd.getNumServices(); i++) {
Service service = (Service) xrd.getServiceAt(i);
if (service == null) continue;
SEPMediaType mediaType = (service.getNumMediaTypes() > 0) ? service.getMediaTypeAt(0) : null;
for (int ii=0; ii<service.getNumTypes(); ii++) {
SEPType type = service.getTypeAt(ii);
if (type == null || type.getValue() == null || type.getValue().trim().equals("")) continue;
for (int iii=0; iii<service.getNumURIs(); iii++) {
SEPUri uri = service.getURIAt(iii);
if (uri == null || uri.getUriString() == null || uri.getUriString().trim().equals("")) continue;
String xrdHref = uri.getUriString();
if (SEPUri.APPEND_AUTHORITY.equals(uri.getAppend()) ||