public byte[] canonSerializeToByteArray(Node node) throws Exception {
  ByteArrayOutputStream baos=new ByteArrayOutputStream();
  canon.setWriter(baos);
  canon.notReset();
  canon.canonicalizeSubtree(node);
  return baos.toByteArray();
}

public byte [ ] canonSerializeToByteArray ( Node node ) throws Exception { ByteArrayOutputStream baos = new ByteArrayOutputStream ( ) ; canon . setWriter ( baos ) ; canon . notReset ( ) ; canon . canonicalizeSubtree ( node ) ; return baos . toByteArray ( ) ; }
use the canonicalizer to serialize the node
