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 System.Xml.Serialization.XmlSerializer.UnknownElement event from being triggered.
Constructors
XmlUnknown()
protected XmlUnknown()
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
CloneFromTo(XmlUnknown, XmlUnknown)
Copies all members declared by XmlUnknown from one instance to another.
protected static void CloneFromTo(XmlUnknown from, XmlUnknown to)
Parameters
fromXmlUnknowntoXmlUnknown
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?)
public override bool Equals(object? obj)
Parameters
objobject
Returns
GetHashCode()
public override int GetHashCode()
Returns
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.