Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static Result parseData() {
- RequestBody body = request().body();
- Document xml = body.asXml();
- if (xml == null) {
- return status(415, "Either XML not properly formatted or content-type not set.");
- } else {
- NamedNodeMap attributes = xml.getFirstChild().getAttributes();
- String CSV = "";
- for (int i = 0; i < attributes.getLength(); i++) {
- if (i == attributes.getLength() -1) {
- CSV = CSV + attributes.item(i).getNodeValue().toString();
- }
- else {
- CSV = CSV + attributes.item(i).getNodeValue().toString() + ", ";
- }
- }
- return ok(CSV);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement