How to convert an XmlDocument to an array?

Try the following:

using System.Text;
using System.Xml;

XmlDocument dom = GetDocument();
byte[] bytes = Encoding.Default.GetBytes(dom.OuterXml);

If you want to preserve the text encoding of the document, then change the Default encoding to the desired encoding, or follow Jon Skeet’s suggestion.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)