XmlDocumentWrapper
using System.Runtime.CompilerServices;
using System.Xml;
namespace Newtonsoft.Json.Converters
{
[System.Runtime.CompilerServices.NullableContext(1)]
[System.Runtime.CompilerServices.Nullable(0)]
internal class XmlDocumentWrapper : XmlNodeWrapper, IXmlDocument, IXmlNode
{
private readonly XmlDocument _document;
[System.Runtime.CompilerServices.Nullable(2)]
public IXmlElement DocumentElement {
[System.Runtime.CompilerServices.NullableContext(2)]
get {
if (_document.DocumentElement == null)
return null;
return new XmlElementWrapper(_document.DocumentElement);
}
}
public XmlDocumentWrapper(XmlDocument document)
: base(document)
{
_document = document;
}
public IXmlNode CreateComment([System.Runtime.CompilerServices.Nullable(2)] string data)
{
return new XmlNodeWrapper(_document.CreateComment(data));
}
public IXmlNode CreateTextNode([System.Runtime.CompilerServices.Nullable(2)] string text)
{
return new XmlNodeWrapper(_document.CreateTextNode(text));
}
public IXmlNode CreateCDataSection([System.Runtime.CompilerServices.Nullable(2)] string data)
{
return new XmlNodeWrapper(_document.CreateCDataSection(data));
}
public IXmlNode CreateWhitespace([System.Runtime.CompilerServices.Nullable(2)] string text)
{
return new XmlNodeWrapper(_document.CreateWhitespace(text));
}
public IXmlNode CreateSignificantWhitespace([System.Runtime.CompilerServices.Nullable(2)] string text)
{
return new XmlNodeWrapper(_document.CreateSignificantWhitespace(text));
}
[System.Runtime.CompilerServices.NullableContext(2)]
[return: System.Runtime.CompilerServices.Nullable(1)]
public IXmlNode CreateXmlDeclaration(string version, string encoding, string standalone)
{
return new XmlDeclarationWrapper(_document.CreateXmlDeclaration(version, encoding, standalone));
}
[System.Runtime.CompilerServices.NullableContext(2)]
[return: System.Runtime.CompilerServices.Nullable(1)]
public IXmlNode CreateXmlDocumentType(string name, string publicId, string systemId, string internalSubset)
{
return new XmlDocumentTypeWrapper(_document.CreateDocumentType(name, publicId, systemId, null));
}
public IXmlNode CreateProcessingInstruction(string target, [System.Runtime.CompilerServices.Nullable(2)] string data)
{
return new XmlNodeWrapper(_document.CreateProcessingInstruction(target, data));
}
public IXmlElement CreateElement(string elementName)
{
return new XmlElementWrapper(_document.CreateElement(elementName));
}
public IXmlElement CreateElement(string qualifiedName, string namespaceUri)
{
return new XmlElementWrapper(_document.CreateElement(qualifiedName, namespaceUri));
}
public IXmlNode CreateAttribute(string name, [System.Runtime.CompilerServices.Nullable(2)] string value)
{
return new XmlNodeWrapper(_document.CreateAttribute(name)) {
Value = value
};
}
public IXmlNode CreateAttribute(string qualifiedName, string namespaceUri, [System.Runtime.CompilerServices.Nullable(2)] string value)
{
return new XmlNodeWrapper(_document.CreateAttribute(qualifiedName, namespaceUri)) {
Value = value
};
}
}
}