public static byte [ ] serializeDoc ( Node n ) throws IOException { XmlDomWriter xw = new XmlDomWriter ( ) ; ByteArrayOutputStream fout = new ByteArrayOutputStream ( ) ; xw . setOutput ( fout , null ) ; xw . setCanonical ( false ) ; xw . write ( n ) ; fout . close ( ) ; return fout . toByteArray ( ) ; }
Serializes a XML document to a byte array .