| 67 | 67 | sTransformer.setOutputProperty( OMIT_XML_DECLARATION, "yes" ); |
| 68 | 68 | sTransformer.setOutputProperty( METHOD, "xml" ); |
| 69 | | sTransformer.setOutputProperty( INDENT, "yes" ); |
| 69 | sTransformer.setOutputProperty( INDENT, "no" ); |
| 70 | 70 | sTransformer.setOutputProperty( INDENT_AMOUNT, "2" ); |
| 71 | 71 | } catch( final Exception ex ) { |
| ... |
| 182 | 182 | |
| 183 | 183 | try( final var writer = new StringWriter() ) { |
| 184 | | final var domSource = new DOMSource( xhtml ); |
| 185 | 184 | final var result = new StreamResult( writer ); |
| 186 | 185 | |
| 187 | | sTransformer.transform( domSource, result ); |
| 186 | transform( xhtml, result ); |
| 188 | 187 | |
| 189 | 188 | return writer.toString(); |
| ... |
| 199 | 198 | |
| 200 | 199 | try( final var writer = new StringWriter() ) { |
| 201 | | sTransformer.transform( |
| 202 | | new DOMSource( root ), new StreamResult( writer ) |
| 203 | | ); |
| 200 | transform( root.getOwnerDocument(), new StreamResult( writer ) ); |
| 204 | 201 | |
| 205 | 202 | return writer.toString(); |
| ... |
| 219 | 216 | final var file = path.toFile(); |
| 220 | 217 | |
| 221 | | sTransformer.transform( |
| 222 | | new DOMSource( sDocumentBuilder.parse( file ) ), new StreamResult( file ) |
| 223 | | ); |
| 218 | transform( sDocumentBuilder.parse( file ), new StreamResult( file ) ); |
| 224 | 219 | } |
| 225 | 220 | |
| ... |
| 244 | 239 | } |
| 245 | 240 | } ); |
| 241 | } |
| 242 | |
| 243 | /** |
| 244 | * Streams an instance of {@link Document} as a plain text XML document. |
| 245 | * |
| 246 | * @param src The source document to transform. |
| 247 | * @param dst The destination location to write the transformed version. |
| 248 | * @throws TransformerException Could not transform the document. |
| 249 | */ |
| 250 | private static void transform( final Document src, final StreamResult dst ) |
| 251 | throws TransformerException { |
| 252 | sTransformer.transform( new DOMSource( src ), dst ); |
| 246 | 253 | } |
| 247 | 254 | |