Element linkE = links.next();
String href = linkE.getAttributeValue("href");
if (href!=null) {
URI tlocation = linkE.getBaseURI().resolve(href);
String mtype = linkE.getAttributeValue("type");
Link l = new Link(linkE.getAttributeValue("rel"),mtype==null ? null : MediaType.valueOf(mtype),tlocation);
l.setIdentity(linkE.getAttributeValue("username"),linkE.getAttributeValue("password"));
if (l.getRelation()!=null) {
host.getLinks().put(l.getRelation(),l);
}
}
}
Iterator<Element> appElements = hostE.getElementsByName(APP);
while (appElements.hasNext()) {
Element appE = appElements.next();
String appName = appE.getAttributeValue("name");
String match = appE.getAttributeValue("match");
AppDef def = appDefs.get(appName);
if (def==null) {
throw new XMLException("Cannot find defintion of application "+appName);
}
AppConf appconf = new AppConf(def,match,(Element)appE.copyOfItem(true),host.getLinks());
Iterator<Element> appLinks = appE.getElementsByName(LINK);
while (appLinks.hasNext()) {
Element linkE = appLinks.next();
String href = linkE.getAttributeValue("href");
if (href!=null) {
URI tlocation = linkE.getBaseURI().resolve(href);
String mtype = linkE.getAttributeValue("type");
Link l = new Link(linkE.getAttributeValue("rel"),mtype==null ? null : MediaType.valueOf(mtype),tlocation);
l.setIdentity(linkE.getAttributeValue("username"),linkE.getAttributeValue("password"));
if (l.getRelation()!=null) {
appconf.getLinks().put(l.getRelation(),l);
}
}
}
Iterator<Element> params = appE.getElementsByName(PARAMETER);
while (params.hasNext()) {