December 14, 201213 yr This code returns the canonical version of an XML document. import javax.xml.crypto.* import org.apache.xml.security.* import org.apache.xml.security.c14n.* if (inputXML!=null){ org.apache.xml.security.Init.init() def XmlBytes = inputXML.getBytes("UTF-8") as byte[] canon = Canonicalizer.getInstance(Canonicalizer.ALGO_ID_C14N_OMIT_COMMENTS) canonXmlBytes = canon.canonicalize(XmlBytes) canonXmlString = new String(canonXmlBytes) return canonXmlString } Hopefully someone else might find it useful. Ian J
Create an account or sign in to comment