Table of Contents

Class XmlUnknown

Namespace
ZeroInstall.Model
Assembly
ZeroInstall.Model.dll

Abstract base class for XML serializable classes that are intended to retain any unknown XML elements or attributes loaded from an XML file.

public abstract class XmlUnknown
Inheritance
object
XmlUnknown
Derived

Remarks

Inheriting from this class will prevent the UnknownElement event from being triggered.

Fields

UnknownAttributes

Contains any unknown additional XML attributes.

public XmlAttribute[]? UnknownAttributes

Field Value

XmlAttribute[]

UnknownElements

Contains any unknown additional XML elements.

public XmlElement[]? UnknownElements

Field Value

XmlElement[]

Methods

EnsureAttribute(object?, string)

Ensures that a value deserialized from an XML attribute is set (not null).

protected void EnsureAttribute(object? value, string attributeName)

Parameters

value object

The mapped value to check.

attributeName string

The name of the XML attribute.

Exceptions

InvalidDataException

value is null.

EnsureAttributeSafeID(string?, string)

Ensures that a value deserialized from an XML attribute is set (not null) and only contains alphanumeric characters, spaces ( ), dots (.), underscores (_), hyphens (-) and plus signs (+).

protected void EnsureAttributeSafeID(string? value, string attributeName)

Parameters

value string

The mapped value to check.

attributeName string

The name of the XML attribute.

Exceptions

InvalidDataException

value is invalid.

Equals(object?)

Determines whether the specified object is equal to the current object.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with the current object.

Returns

bool

true if the specified object is equal to the current object; otherwise, false.

GetHashCode()

Serves as the default hash function.

public override int GetHashCode()

Returns

int

A hash code for the current object.

ToShortXml()

Returns a shortened XML representation (with attributes but without child elements).

[UnconditionalSuppressMessage("AOT", "IL3050", Justification = "Uses fallback when dynamic code generation is not available")]
public string ToShortXml()

Returns

string

Remarks

Intended for use in error messages. Not suitable for parsing. Use ToXmlString<T>(T, string) instead if you need a full XML representation.