Skip to main content

Definition

Assembly: CloudNimble.XmlEssentials.dll Namespace: CloudNimble.Text.Xml.Serialization Inheritance: System.Enum

Syntax

Summary

Specifies how XmlSerializer handles the named floating-point literals INF, -INF, and NaN when serializing and deserializing.

Usage

XmlNumberHandling says whether the XML Schema names for the floating-point values that aren’t numbers are allowed: INF, -INF, and NaN. Set it through XmlSerializerOptions.NumberHandling. It applies to float and double values. Use Strict when the consumer of the XML treats the element as a plain decimal number and would fail on a name.

Considerations

  • The default is the reverse of System.Text.Json, where named floating-point literals must be turned on. INF, -INF, and NaN are part of the XML Schema definition of float and double, so XML consumers that follow XML Schema accept them.
  • The setting doesn’t affect integers or decimal, which have no such values.
  • Unlike JsonNumberHandling, there are no values for reading numbers from quoted strings. Every XML value is text already.

Values

  • CloudNimble.Text.Xml.XmlSerializerOptions
  • CloudNimble.Text.Xml.XmlException