public String getPositionsAsXML() { ArrayList<Position> pList = new ArrayList<Position>(positionMap.values()); Collections.sort(pList); StringBuilder xml = new StringBuilder("<positions>"); for (Position p : pList) xml.append(p.toXML()); xml.append("</positions>"); return xml.toString(); }
public String getParticipantPositionsAsXML(String pid) { Set<Position> posSet = getParticipantPositions(pid); if (posSet != null) { String header = String.format("<positions participantid=\"%s\">", pid); StringBuilder xml = new StringBuilder(header); for (Position p : posSet) xml.append(p.toXML()); xml.append("</positions>"); return xml.toString(); } else return ("<positions/>"); }