CrystalXmlSettings
Namespace: SnowBank.Data.Xml · struct
Implements: IEquatable<CrystalXmlSettings>
Runtime options a CrystalXml writer reads while it turns a value into text or bytes
Remarks
A readonly``struct that wraps a single flags field, so it is passed by value in a register. Build one from a preset and the fluent With... methods: CrystalXmlSettings.DataContractCompat.WithOmitNamespaces().WithNewLine(CrystalXmlNewLine.Lf)
Profile and OmitNamespaces name the element names, which the source generator bakes into the converter, so they come from the container's [CrystalXmlOutput] attribute at generation time. The writer-level options (Indented, NewLine, EmptyElementStyle, WriteXmlDeclaration) are applied while writing and can be overridden per call.
default(CrystalXmlSettings) is General: the general profile, compact output (not indented), self-closing empty elements, no declaration.
Properties
DataContractCompat
static CrystalXmlSettings DataContractCompat { get; }
DataContract profile: the output DataContractSerializer writes
EmptyElementStyle
CrystalXmlEmptyElementStyle EmptyElementStyle { get; }
How an element with no content is written
Flags
OptionFlags Flags { get; }
The raw flags
General
static CrystalXmlSettings General { get; }
General profile, compact output: the default for new documents
Indented
bool Indented { get; }
true when the output is indented across multiple lines instead of written compact on one line (the default is compact)
is consulted only when this is set.
NewLine
CrystalXmlNewLine NewLine { get; }
Structural line ending written between elements when Indented is set
OmitNamespaces
bool OmitNamespaces { get; }
true when the DataContract output drops namespaces and prefixes, keeping the rest of that format
Profile
CrystalXmlSerializerDefaults Profile { get; }
Format the names follow: General or DataContractCompat
Never : that value is resolved away at generation time, before it ever reaches a runtime .
ShowNullMembers
bool ShowNullMembers { get; }
true when a member whose value is null is written instead of omitted
WriteXmlDeclaration
bool WriteXmlDeclaration { get; }
true when the <?xml ...?> declaration is written
Methods
Equals
bool Equals(CrystalXmlSettings other)
bool Equals(object obj)
GetHashCode
int GetHashCode()
WithEmptyElementStyle
CrystalXmlSettings WithEmptyElementStyle(CrystalXmlEmptyElementStyle value)
Returns a copy with the empty-element style set
WithIndented
CrystalXmlSettings WithIndented(bool value = true)
Returns a copy with Indented set
WithNewLine
CrystalXmlSettings WithNewLine(CrystalXmlNewLine value)
Returns a copy with the structural line ending set
WithNullMembers
CrystalXmlSettings WithNullMembers()
Returns a copy that writes a member whose value is null instead of omitting it
WithOmitNamespaces
CrystalXmlSettings WithOmitNamespaces(bool value = true)
Returns a copy with OmitNamespaces set
WithXmlDeclaration
CrystalXmlSettings WithXmlDeclaration(bool value = true)
Returns a copy that writes (or omits) the <?xml ...?> declaration
WithoutNullMembers
CrystalXmlSettings WithoutNullMembers()
Returns a copy that omits a member whose value is null