code: public static byte[] canonicalize(byte[] inBytes) throws IOException {
          try {
              Canonicalizer c = Canonicalizer.getInstance(
                      Canonicalizer.ALGO_ID_C14N11_OMIT_COMMENTS);
              return c.canonicalize(inBytes);
          } catch (Exception e) {
              throw new IOException(e);
          }
      }
docs: Produces the canonicalized form of the input document, without comments,
  as defined by <a href="http://www.w3.org/TR/xml-c14n11/">XML
  Canonicalization 1.1</a>.
  <p>
  <b>NOTE:</b> Although this method will likely fail if the input is
  malformed XML, successful canonicalization does not imply that the
  input was well-formed!
  
  @param inBytes the xml to be canonicalized.
  @return the canonicalized XML as a UTF-8 encoded byte array.
  @throws IOException if the input cannot be canonicalized for any reason.