How to convert an XmlDocument to an array?

前端 未结 3 1427
别跟我提以往
别跟我提以往 2020-12-14 06:59

I constructed an XmlDocument and now I want to convert it to an array. How can this be done?

Thanks,

3条回答
  •  臣服心动
    2020-12-14 07:20

    Steve Guidi: Thanks! Your code was right on the money! Here's how I solved my special characters issue:

        public static byte[] ConvertToBytes(XmlDocument doc)
        {
            Encoding encoding = Encoding.UTF8;
            byte[] docAsBytes = encoding.GetBytes(doc.OuterXml);
            return docAsBytes;
        } 
    

提交回复
热议问题