Advertisement
Guest User

Untitled

a guest
Feb 21st, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. public static Result parseData() {
  2. RequestBody body = request().body();
  3. Document xml = body.asXml();
  4. if (xml == null) {
  5. return status(415, "Either XML not properly formatted or content-type not set.");
  6. } else {
  7.  
  8.  
  9. NamedNodeMap attributes = xml.getFirstChild().getAttributes();
  10. String CSV = "";
  11.  
  12. for (int i = 0; i < attributes.getLength(); i++) {
  13. if (i == attributes.getLength() -1) {
  14. CSV = CSV + attributes.item(i).getNodeValue().toString();
  15. }
  16. else {
  17. CSV = CSV + attributes.item(i).getNodeValue().toString() + ", ";
  18. }
  19. }
  20.  
  21. return ok(CSV);
  22. }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement