XObjectWrapper
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Xml;
using System.Xml.Linq;
namespace Newtonsoft.Json.Converters
{
[System.Runtime.CompilerServices.NullableContext(2)]
[System.Runtime.CompilerServices.Nullable(0)]
internal class XObjectWrapper : IXmlNode
{
private readonly XObject _xmlObject;
public object WrappedNode => _xmlObject;
public virtual XmlNodeType NodeType => _xmlObject?.NodeType ?? XmlNodeType.None;
public virtual string LocalName => null;
[System.Runtime.CompilerServices.Nullable(1)]
public virtual List<IXmlNode> ChildNodes {
[System.Runtime.CompilerServices.NullableContext(1)]
get {
return XmlNodeConverter.EmptyChildNodes;
}
}
[System.Runtime.CompilerServices.Nullable(1)]
public virtual List<IXmlNode> Attributes {
[System.Runtime.CompilerServices.NullableContext(1)]
get {
return XmlNodeConverter.EmptyChildNodes;
}
}
public virtual IXmlNode ParentNode => null;
public virtual string Value {
get {
return null;
}
set {
throw new InvalidOperationException();
}
}
public virtual string NamespaceUri => null;
public XObjectWrapper(XObject xmlObject)
{
_xmlObject = xmlObject;
}
[System.Runtime.CompilerServices.NullableContext(1)]
public virtual IXmlNode AppendChild(IXmlNode newChild)
{
throw new InvalidOperationException();
}
}
}