public void WriteXml(XmlWriter writer)
        {
            writer.WriteAttributeString("xmlns", StorageFault.typeName.Namespace);

            XmlSerializableServices.WriteNodes(writer, this.Nodes);

            if (!string.IsNullOrWhiteSpace(faultMessageId))
            {
                XNamespace faultNamespace  = "http://fault.vasa.vim.vmware.com/xsd";
                var        xFaultMessageId = new XElement(faultNamespace + "faultMessageId", this.faultMessageId);
                XmlSerializableServices.WriteNodes(writer, new [] { GetXmlNode(xFaultMessageId) });

                if (parameterList != null && parameterList.Length > 0)
                {
                    XNamespace dataNamespace  = "http://data.vasa.vim.vmware.com/xsd";
                    var        xParameterList = new XElement(faultNamespace + "parameterList",
                                                             new XAttribute(XNamespace.Xmlns + "data", "http://data.vasa.vim.vmware.com/xsd"));

                    foreach (var param in parameterList)
                    {
                        var xParam = new XElement(dataNamespace + "NameValuePair",
                                                  new XElement(dataNamespace + "parameterName", param.parameterName),
                                                  new XElement(dataNamespace + "parameterValue", param.parameterValue));
                        xParameterList.Add(xParam);
                    }

                    XmlSerializableServices.WriteNodes(writer, new[] { GetXmlNode(xParameterList) });
                }
            }
        }
Example #2
0
 public void WriteXml(XmlWriter writer)
 {
     XmlSerializableServices.WriteNodes(writer, Nodes);
 }