git-svn-id: svn://anubis/gvsu@289 45c1a28c-8058-47b2-ae61-ca45b979098e
This commit is contained in:
josh 2008-11-29 18:16:21 +00:00
parent 029d7eb3e2
commit d391455acb

View File

@ -18,29 +18,32 @@ public class User extends RegistrationInfo
{ {
DomRepresentation rep = new DomRepresentation(MediaType.TEXT_XML); DomRepresentation rep = new DomRepresentation(MediaType.TEXT_XML);
Document d = rep.getDocument(); Document d = rep.getDocument();
Element eltRoot = d.createElement("user");
d.appendChild(eltRoot);
fillNodes(d, eltRoot); fillNodes(d, null);
return rep; return rep;
} }
public void fillNodes(Document d, Element eltRoot) public void fillNodes(Document d, Element eltParent)
{ {
Element eltRoot = d.createElement("user");
if (eltParent == null)
d.appendChild(eltRoot);
else
eltRoot.appendChild(eltRoot);
Element eltName = d.createElement("name"); Element eltName = d.createElement("name");
eltName.appendChild(d.createTextNode(getUserName())); eltName.appendChild(d.createTextNode(getUserName()));
eltRoot.appendChild(eltName); eltRoot.appendChild(eltName);
Element eltHost = d.createElement("host"); Element eltHost = d.createElement("host");
eltHost.appendChild(d.createTextNode(getHost())); eltHost.appendChild(d.createTextNode(getHost()));
eltRoot.appendChild(eltHost); eltRoot.appendChild(eltHost);
Element eltPort = d.createElement("port"); Element eltPort = d.createElement("port");
eltPort.appendChild(d.createTextNode((new Integer(getPort())).toString())); eltPort.appendChild(d.createTextNode((new Integer(getPort())).toString()));
eltRoot.appendChild(eltPort); eltRoot.appendChild(eltPort);
Element eltStatus = d.createElement("status"); Element eltStatus = d.createElement("status");
eltStatus.appendChild( eltStatus.appendChild(
d.createTextNode(getStatus() ? "available" : "away")); d.createTextNode(getStatus() ? "available" : "away"));