I constructed an XmlDocument and now I want to convert it to an array. How can this be done?
Thanks,
See Question&Answers more detail:osI constructed an XmlDocument and now I want to convert it to an array. How can this be done?
Thanks,
See Question&Answers more detail:osTry 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.