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()) ||
SEPUri.APPEND_LOCAL.equals(uri.getAppend()) ||
SEPUri.APPEND_QXRI.equals(uri.getAppend())) {
if (! xrdHref.endsWith("/")) xrdHref += "/";
xrdHref += canonical;
}
String xrdRel = type.getType();
String xrdType = (mediaType != null && mediaType.getValue() != null && (! mediaType.getValue().trim().equals(""))) ? mediaType.getMediaType() : null;
appendLink(buffer, xrdRel, xrdHref, xrdType);
}
}