There have been times in a grails controller I've wanted direct access to the xml in a POST request. You can retreive this via the request object: request.reader.text But what if you need access the raw xml and then to also use the xmlslurper to pick apart the xml. Accessing the request.XML after request.reader.xml throws this exception: java.lang.IllegalStateException: getReader() has already been called for this request
Say I have the following xml:
and I want to access the raw xml tag 'three' but I want programmatic access to the tag 'two'. The following allows that:
No comments:
Post a Comment