diff --git a/docs/standard/serialization/examples-of-xml-serialization.md b/docs/standard/serialization/examples-of-xml-serialization.md index 40ada8f300cad..326729345691b 100644 --- a/docs/standard/serialization/examples-of-xml-serialization.md +++ b/docs/standard/serialization/examples-of-xml-serialization.md @@ -379,21 +379,21 @@ Imports System.Xml.Serialization Imports System.IO Imports Microsoft.VisualBasic -' The XmlRootAttribute allows you to set an alternate name +' The XmlRoot attribute allows you to set an alternate name ' (PurchaseOrder) for the XML element and its namespace. By ' default, the XmlSerializer uses the class name. The attribute ' also allows you to set the XML namespace for the element. Lastly, ' the attribute sets the IsNullable property, which specifies whether ' the xsi:null attribute appears if the class instance is set to ' a null reference. - _ Public Class PurchaseOrder Public ShipTo As Address Public OrderDate As String ' The XmlArrayAttribute changes the XML element name ' from the default of "OrderedItems" to "Items". - _ + _ Public OrderedItems() As OrderedItem Public SubTotal As Decimal Public ShipCost As Decimal @@ -401,7 +401,7 @@ Public Class PurchaseOrder End Class Public Class Address - ' The XmlAttribute instructs the XmlSerializer to serialize the + ' The XmlAttribute attribute instructs the XmlSerializer to serialize the ' Name field as an XML attribute instead of an XML element (the ' default behavior). _ @@ -411,7 +411,7 @@ Public Class Address ' Setting the IsNullable property to false instructs the ' XmlSerializer that the XML attribute will not appear if ' the City field is set to a null reference. - _ + _ Public City As String Public State As String Public Zip As String @@ -557,22 +557,22 @@ using System.Xml; using System.Xml.Serialization; using System.IO; -// The XmlRootAttribute allows you to set an alternate name +// The XmlRoot attribute allows you to set an alternate name // (PurchaseOrder) for the XML element and its namespace. By // default, the XmlSerializer uses the class name. The attribute // also allows you to set the XML namespace for the element. Lastly, // the attribute sets the IsNullable property, which specifies whether // the xsi:null attribute appears if the class instance is set to // a null reference. -[XmlRootAttribute("PurchaseOrder", Namespace="http://www.cpandl.com", +[XmlRoot("PurchaseOrder", Namespace="http://www.cpandl.com", IsNullable = false)] public class PurchaseOrder { public Address ShipTo; public string OrderDate; - // The XmlArrayAttribute changes the XML element name + // The XmlArray attribute changes the XML element name // from the default of "OrderedItems" to "Items". - [XmlArrayAttribute("Items")] + [XmlArray("Items")] public OrderedItem[] OrderedItems; public decimal SubTotal; public decimal ShipCost; @@ -581,7 +581,7 @@ public class PurchaseOrder public class Address { - // The XmlAttribute instructs the XmlSerializer to serialize the + // The XmlAttribute attribute instructs the XmlSerializer to serialize the // Name field as an XML attribute instead of an XML element (the // default behavior). [XmlAttribute] @@ -591,7 +591,7 @@ public class Address // Setting the IsNullable property to false instructs the // XmlSerializer that the XML attribute will not appear if // the City field is set to a null reference. - [XmlElementAttribute(IsNullable = false)] + [XmlElement(IsNullable = false)] public string City; public string State; public string Zip;