Skip to content

Commit 12cf06d

Browse files
committed
Configure XML Transformer in a Saxon-compatible manner
Closes gh-615
1 parent 99f4b47 commit 12cf06d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

spring-restdocs-core/src/main/java/org/springframework/restdocs/payload/XmlContentHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,10 @@ private String prettyPrint(Document document) {
173173
StringWriter stringWriter = new StringWriter();
174174
StreamResult xmlOutput = new StreamResult(stringWriter);
175175
TransformerFactory transformerFactory = TransformerFactory.newInstance();
176-
transformerFactory.setAttribute("indent-number", 4);
177176
Transformer transformer = transformerFactory.newTransformer();
178177
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
179178
transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
179+
transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4");
180180
transformer.transform(new DOMSource(document), xmlOutput);
181181
return xmlOutput.getWriter().toString();
182182
}

0 commit comments

Comments
 (0)