spring-restdocs icon indicating copy to clipboard operation
spring-restdocs copied to clipboard

XmlContentHandler's pretty printing of undocumented content fails when Saxon is on the classpath

Open willredclef opened this issue 5 years ago • 0 comments

There seems to be an assumed dependency on Xalan in org.springframework.restdocs.payload.XmlContentHandler of spring-restdocs-core-2.0.3.RELEASE.jar.

Line 180 has this:

     transformerFactory.setAttribute("indent-number", 4)

Saxon uses "indent-spaces" attribute for the same thing, so perhaps this should be:

     try {
          transformerFactory.setAttribute("indent-number", 4);
     } catch (IllegalArgumentException e) {
          transformerFactory.setAttribute("indent-spaces", 4);
     }

Otherwise,

     .andDo(document("foo.xml", responseFields(... 

throws IllegalArgumentException when Saxon-HE-9.8.0-8.jar is on the classpath.

willredclef avatar May 06 '19 21:05 willredclef