Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move serialization docs #2780

Merged
merged 4 commits into from
Aug 3, 2017
Merged

move serialization docs #2780

merged 4 commits into from
Aug 3, 2017

Conversation

mairaw
Copy link
Contributor

@mairaw mairaw commented Jul 29, 2017

Fixes Part 1 of #2770

Copy link
Contributor

@rpetrusha rpetrusha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mairaw, this looks good. There is one formatting issue, a number of MSDN URLs that could be converted to xrefs, and a number of other MSDN URLs that could be converted to docs.

[How to: Override Encoded SOAP XML Serialization](../../../docs/framework/serialization/how-to-override-encoded-soap-xml-serialization.md)
[XML and SOAP Serialization](../../../docs/standard/serialization/xml-and-soap-serialization.md)
[How to: Serialize an Object as a SOAP-Encoded XML Stream](../../../docs/standard/serialization/how-to-serialize-an-object-as-a-soap-encoded-xml-stream.md)
[How to: Override Encoded SOAP XML Serialization](../../../docs/standard/serialization/how-to-override-encoded-soap-xml-serialization.md)
[Attributes](../../../docs/standard/attributes/index.md)
[XmlSerializer](https://msdn.microsoft.com/en-us/library/system.xml.serialization.xmlserializer.aspx)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

convert to xref?

@@ -26,9 +26,9 @@ ms.author: "erikre"
manager: "erikre"
---
# Attributes That Control XML Serialization
You can apply the attributes in the following table to classes and class members to control the way in which the [XmlSerializer](https://msdn.microsoft.com/en-us/library/system.xml.serialization.xmlserializer.aspx) serializes or deserializes an instance of the class. To understand how these attributes control XML serialization, see [Controlling XML Serialization Using Attributes](../../../docs/framework/serialization/controlling-xml-serialization-using-attributes.md).
You can apply the attributes in the following table to classes and class members to control the way in which the [XmlSerializer](https://msdn.microsoft.com/en-us/library/system.xml.serialization.xmlserializer.aspx) serializes or deserializes an instance of the class. To understand how these attributes control XML serialization, see [Controlling XML Serialization Using Attributes](../../../docs/standard/serialization/controlling-xml-serialization-using-attributes.md).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

convert to xref?


## See Also
[XML and SOAP Serialization](../../../docs/framework/serialization/xml-and-soap-serialization.md)
[XML and SOAP Serialization](../../../docs/standard/serialization/xml-and-soap-serialization.md)
[XmlSerializer](https://msdn.microsoft.com/en-us/library/system.xml.serialization.xmlserializer.aspx)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Convert to xref?

@@ -94,9 +94,9 @@ manager: "erikre"
<xref:System.Xml.Serialization>
[Random class](https://msdn.microsoft.com/en-us/library/system.random.aspx)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

xref?

@@ -94,9 +94,9 @@ manager: "erikre"
<xref:System.Xml.Serialization>
[Random class](https://msdn.microsoft.com/en-us/library/system.random.aspx)
[System.IO namespace](https://msdn.microsoft.com/en-us/library/system.io.aspx)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

xref?

@@ -31,10 +31,10 @@ ms.author: "erikre"
manager: "erikre"
---
# XML Serialization with XML Web Services
XML serialization is the underlying transport mechanism used in the XML Web services architecture, performed by the [XmlSerializer](https://msdn.microsoft.com/en-us/library/system.xml.serialization.xmlserializer.aspx) class. To control the XML generated by an XML Web service, you can apply the attributes listed in both [Attributes That Control XML Serialization](../../../docs/framework/serialization/attributes-that-control-xml-serialization.md) and [Attributes That Control Encoded SOAP Serialization](../../../docs/framework/serialization/attributes-that-control-encoded-soap-serialization.md) to the classes, return values, parameters, and fields of a file used to create an XML Web service (.asmx). For more information about creating an XML Web service, see [Building XML Web Services Using ASP.NET](http://msdn.microsoft.com/en-us/01dfc27c-c68e-4910-a0aa-5e4c2a766b0c).
XML serialization is the underlying transport mechanism used in the XML Web services architecture, performed by the [XmlSerializer](https://msdn.microsoft.com/en-us/library/system.xml.serialization.xmlserializer.aspx) class. To control the XML generated by an XML Web service, you can apply the attributes listed in both [Attributes That Control XML Serialization](../../../docs/standard/serialization/attributes-that-control-xml-serialization.md) and [Attributes That Control Encoded SOAP Serialization](../../../docs/standard/serialization/attributes-that-control-encoded-soap-serialization.md) to the classes, return values, parameters, and fields of a file used to create an XML Web service (.asmx). For more information about creating an XML Web service, see [Building XML Web Services Using ASP.NET](http://msdn.microsoft.com/en-us/01dfc27c-c68e-4910-a0aa-5e4c2a766b0c).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

convert XmlSerializer URL to xref?

@@ -15,7 +15,7 @@
<format type="text/markdown"><![CDATA[

## Remarks
This enumeration is used by the serialization infrastructure only, and is not intended for public use. To actually set the serialization mode, create an application configuration file, and set the [\&lt;dateTimeSerialization\&gt; Element](~/docs/framework/serialization/datetimeserialization-element.md) to an appropriate setting. For more information about configuration files, see [Configuration File Schema](http://msdn.microsoft.com/library/69003d39-dc8a-460c-a6be-e6d93e690b38).
This enumeration is used by the serialization infrastructure only, and is not intended for public use. To actually set the serialization mode, create an application configuration file, and set the [\&lt;dateTimeSerialization\&gt; Element](~/docs/standard/serialization/datetimeserialization-element.md) to an appropriate setting. For more information about configuration files, see [Configuration File Schema](http://msdn.microsoft.com/library/69003d39-dc8a-460c-a6be-e6d93e690b38).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The configuration file schema link could change to docs: ~/docs/framework/configure-apps/file-schema/

@@ -16,7 +16,7 @@
<format type="text/markdown"><![CDATA[

## Remarks
This class handles the configuration element [\&lt;dateTimeSerialization\&gt; Element](~/docs/framework/serialization/datetimeserialization-element.md) found under the [\&lt;system.xml.serialization\&gt; Element](~/docs/framework/serialization/system-xml-serialization-element.md). For more information about configuration files, see [Configuration File Schema](http://msdn.microsoft.com/library/69003d39-dc8a-460c-a6be-e6d93e690b38).
This class handles the configuration element [\&lt;dateTimeSerialization\&gt; Element](~/docs/standard/serialization/datetimeserialization-element.md) found under the [\&lt;system.xml.serialization\&gt; Element](~/docs/standard/serialization/system-xml-serialization-element.md). For more information about configuration files, see [Configuration File Schema](http://msdn.microsoft.com/library/69003d39-dc8a-460c-a6be-e6d93e690b38).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The configuration file schema link could change to docs: ~/docs/framework/configure-apps/file-schema/


You can override the behavior caused by the <xref:System.Xml.Serialization.XmlIgnoreAttribute> by creating an <xref:System.Xml.Serialization.XmlAttributes> object, and setting its <xref:System.Xml.Serialization.XmlAttributes.XmlIgnore%2A> property to `false`. You must <xref:System.Xml.Serialization.XmlAttributeOverrides.Add%2A> the <xref:System.Xml.Serialization.XmlAttributes> object to an instance of the <xref:System.Xml.Serialization.XmlAttributeOverrides> class. Lastly, you must use the <xref:System.Xml.Serialization.XmlAttributeOverrides> object to construct an instance of the <xref:System.Xml.Serialization.XmlSerializer> class before you call the <xref:System.Xml.Serialization.XmlSerializer.Serialize%2A> or <xref:System.Xml.Serialization.XmlSerializer.Deserialize%2A> methods.

The [XML Schema Definition Tool (Xsd.exe)](~/docs/framework/serialization/xml-schema-definition-tool-xsd-exe.md) occasionally generates the <xref:System.Xml.Serialization.XmlIgnoreAttribute> when creating classes from a schema file (.xsd). This behavior occurs because value types cannot be set to `null`, but all XML data types can be. Therefore, the tool creates two fields when it encounters an XML type that maps to a value type: one to hold the value and another special field that takes the form of `fieldnameSpecified`, where the `fieldname` is replaced by the name of the field or property. Notice, however, that this special field is generated only when the schema specifies that the element has no minimum occurrence (minOccurs = "0") and that the element has no default value. The <xref:System.Xml.Serialization.XmlSerializer> sets and checks this special field to determine whether a value has been set for the field or property. Because the special field must not be serialized, the tool applies the <xref:System.Xml.Serialization.XmlIgnoreAttribute> to it.
The [XML Schema Definition Tool (Xsd.exe)](~/docs/standard/serialization/xml-schema-definition-tool-xsd-exe.md) occasionally generates the <xref:System.Xml.Serialization.XmlIgnoreAttribute> when creating classes from a schema file (.xsd). This behavior occurs because value types cannot be set to `null`, but all XML data types can be. Therefore, the tool creates two fields when it encounters an XML type that maps to a value type: one to hold the value and another special field that takes the form of `fieldnameSpecified`, where the `fieldname` is replaced by the name of the field or property. Notice, however, that this special field is generated only when the schema specifies that the element has no minimum occurrence (minOccurs = "0") and that the element has no default value. The <xref:System.Xml.Serialization.XmlSerializer> sets and checks this special field to determine whether a value has been set for the field or property. Because the special field must not be serialized, the tool applies the <xref:System.Xml.Serialization.XmlIgnoreAttribute> to it.

For more information about using attributes, see [Attributes](http://msdn.microsoft.com/library/30386922-1e00-4602-9ebf-526b271a8b87).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change link to ~/docs/standard/attributes/?


> [!NOTE]
> If you set the <xref:System.Xml.Serialization.XmlTypeAttribute.IncludeInSchema%2A> property to `false`, the [XML Schema Definition Tool (Xsd.exe)](~/docs/framework/serialization/xml-schema-definition-tool-xsd-exe.md) does not include the type in the schema. By default, for each public class, the XSD tool generates a `complexType` and an element of that type.
> If you set the <xref:System.Xml.Serialization.XmlTypeAttribute.IncludeInSchema%2A> property to `false`, the [XML Schema Definition Tool (Xsd.exe)](~/docs/standard/serialization/xml-schema-definition-tool-xsd-exe.md) does not include the type in the schema. By default, for each public class, the XSD tool generates a `complexType` and an element of that type.

For more information about using attributes, see [Attributes](http://msdn.microsoft.com/library/30386922-1e00-4602-9ebf-526b271a8b87).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change link to ~/docs/standard/attributes/?

@mairaw
Copy link
Contributor Author

mairaw commented Aug 1, 2017

@rpetrusha good catch on those links! Even though the comments were not really related to moving the docs, I made the fixes. Please review. I've done some global fixes, so the number of files impacted is probably bigger than the number of files you've given feedback to.

@rpetrusha
Copy link
Contributor

Thanks for making the additional changes, @mairaw. This looks really good. It's ready to merge when you want to.

@mairaw
Copy link
Contributor Author

mairaw commented Aug 1, 2017

I've noticed I've missed one of the serializer msdn links (my VS Code was super slow yesterday). Fixed that one and I'll merge if builds looks good. Thanks @rpetrusha!

@mairaw mairaw mentioned this pull request Aug 2, 2017
@mairaw mairaw merged commit a95433d into dotnet:master Aug 3, 2017
@mairaw mairaw deleted the serialization branch August 3, 2017 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants