Hello Simon,
you can use two kinds of XML representations: DomRepresentation and
SaxRepresentation.
You can instantiate both of them with the posted representation. E.g.:
DomRepresentation xmlRep = new DomRepresentation(rep);
The DomRepresentation gives you access to the Dom document. The
SaxRepresentation allows you to parse the XML doc with your own
contentHandler.
See the javadocs here [1] and here [2].
Best regards,
Thierry Boileau
--
Restlet ~ Core developer ~ http://www.restlet.org
Noelios Technologies ~ Co-founder ~ http://www.noelios.com
[1]
http://www.restlet.org/documentation/1.1/api/org/restlet/resource/DomRepresentation.html
[2]
http://www.restlet.org/documentation/1.1/api/org/restlet/resource/SaxRepresentation.html
I have my resource and they typical overridden method to handle POST requests.
public void acceptRepresentation(Representation rep) {
if (MediaType.APPLICATION_XML.equals(rep.getMediaType())) {
//Do stuff here
}
else {
//complain!
}
}
What I want to know is the best practice to handle my packet of XML. I see a
lot of examples using a Form - but surely there is a way to work with the
Representation object itself or cast it to some useful XML object???
Any help on how you should and do parse incoming XML in your resource is much
appreciated.
--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=1023840
--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=1024110