Microsoft.Protocols.TestSuites.SharedAdapter.RequestMessageBodyWriter.WriteNode C# (CSharp) Method

WriteNode() private method

This method is used to write a XML node to a XML writer.
private WriteNode ( XmlNode node, XmlDictionaryWriter writer ) : void
node System.Xml.XmlNode Specify the XML node.
writer System.Xml.XmlDictionaryWriter Specify the XML writer.
return void
        private void WriteNode(XmlNode node, XmlDictionaryWriter writer)
        {
            writer.WriteStartElement(node.Name);
            foreach (XmlAttribute xmlAttribute in node.Attributes)
            {
                writer.WriteAttributeString(xmlAttribute.Name, xmlAttribute.Value);
                if (!string.IsNullOrEmpty(xmlAttribute.Prefix))
                {
                    writer.WriteXmlnsAttribute(xmlAttribute.Prefix, xmlAttribute.NamespaceURI);
                }
            }

            if (node.Name == "SubRequestData")
            {
                string base64 = node.InnerText;
                byte[] bytes = Convert.FromBase64String(base64);
                writer.WriteBase64(bytes, 0, bytes.Length);
            }
            else
            {
                foreach (XmlNode childNode in node.ChildNodes)
                {
                    this.WriteNode(childNode, writer);
                }
            }

            writer.WriteEndElement();
        }