use of org.apache.xml.security.stax.impl.transformer.canonicalizer.Canonicalizer20010315_ExclOmitCommentsTransformer in project santuario-java by apache.
the class EmptyNamespaceTest method doStAXTest.
@org.junit.Test
public void doStAXTest() throws Exception {
org.apache.xml.security.Init.init();
org.apache.xml.security.stax.config.Init.init(null, EmptyNamespaceTest.class);
List<String> inclusiveNamespaces = Arrays.asList("SOAP-ENV ec ec1 ns0 ns1 ns11 ns2 ns4 ns9".split(" "));
Canonicalizer20010315_Excl transformer = new Canonicalizer20010315_ExclOmitCommentsTransformer();
Map<String, Object> properties = new HashMap<>();
properties.put(Canonicalizer20010315_Excl.INCLUSIVE_NAMESPACES_PREFIX_LIST, inclusiveNamespaces);
transformer.setProperties(properties);
try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
InputStream stream = new ByteArrayInputStream(message.getBytes(java.nio.charset.StandardCharsets.UTF_8))) {
transformer.setOutputStream(outputStream);
transformer.transform(stream);
transformer.doFinal();
String result = outputStream.toString();
Assert.assertEquals(message, result);
}
}
Aggregations