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
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
Exceptions
- InvalidDataException
value
isnull
.
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
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
XmlUnknownAn object to compare with this 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).
public string ToShortXml()
Returns
Remarks
Intended for use in error messages. Not suitable for parsing. Use ToXmlString(object, string) instead if you need a full XML representation.