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 : IEquatable<XmlUnknown>
Inheritance
XmlUnknown
Implements
Derived
Inherited Members

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(XmlUnknown?)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(XmlUnknown? other)

Parameters

other XmlUnknown

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; 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).

public string ToShortXml()

Returns

string

Remarks

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