Java XML: Difference between revisions
Jump to navigation
Jump to search
(Created page with "= Canonical xml = When you want to compare xml or check signatures after manipulating xml - note namespaces and prefixes... Canonical class bundled with Java 6 or available f...") |
(No difference)
|
Latest revision as of 21:02, 14 September 2021
Canonical xml
When you want to compare xml or check signatures after manipulating xml - note namespaces and prefixes...
Canonical class bundled with Java 6 or available from xml-security http://santuario.apache.org/
Essential you use init or you get an exception: "com.sun.org.apache.xml.internal.security.c14n.InvalidCanonicalizerException: Unknown canonicalizer. No handler installed for URI http://www.w3.org/TR/2001/REC-xml-c14n-20010315"
import com.sun.org.apache.xml.internal.security.Init; import com.sun.org.apache.xml.internal.security.c14n.Canonicalizer; Init.init(); Canonicalizer c = Canonicalizer.getInstance(Canonicalizer.ALGO_ID_C14N_OMIT_COMMENTS); byte[] bres = c.canonicalize(xmlString.getBytes());