@Override
public Representation addList(ResourceList resources, String prefixIfListIsEmpty) {
if (resources == null){
throw new IllegalArgumentException("Resources is null");
}
Element root = this.document.getDocumentElement();
if (root == null) {
throw new XmlException("The document has no Root Element");
}
if (resources.isEmpty()){
Element emptyListElement = this.document.createElement(prefixIfListIsEmpty) ;
root.appendChild(emptyListElement);
}else{
Resource r0 = resources.get(0);
Element list = this.document.createElement(r0.getListPrefix());
root.appendChild(list);
for (Object r : resources){
Element elt = this.document.createElement(r0.getPrefix());
list.appendChild(elt);
Element id=this.document.createElement("id");
elt.appendChild(id);
id.appendChild(document.createTextNode((((Resource)r).getId().toString())));
Element show = this.document.createElement("show");
elt.appendChild(show);
show.appendChild(document.createTextNode(r.toString()));
}
}
return this;
}