Skip to content

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

@willredclef

Description

@willredclef

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions