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
-
objectXmlUnknown
- 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
UnknownElements
Contains any unknown additional XML elements.
public XmlElement[]? UnknownElements
Field Value
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
valueobjectThe mapped value to check.
attributeNamestringThe name of the XML attribute.
Exceptions
- InvalidDataException
valueisnull.
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
Exceptions
- InvalidDataException
valueis invalid.
Equals(object?)
Determines whether the specified object is equal to the current object.
public override bool Equals(object? obj)
Parameters
objobjectThe object to compare with the current object.
Returns
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
Remarks
Intended for use in error messages. Not suitable for parsing. Use ToXmlString<T>(T, string) instead if you need a full XML representation.