상속: IXmlNode
예제 #1
0
        public IXmlNode AppendChild(IXmlNode newChild)
        {
            XmlNodeWrapper xmlNodeWrapper = (XmlNodeWrapper)newChild;

            this._node.AppendChild(xmlNodeWrapper._node);
            return(newChild);
        }
예제 #2
0
        public IXmlNode CreateAttribute(string qualifiedName, string namespaceURI, string value)
        {
            XmlNodeWrapper xmlNodeWrapper = new XmlNodeWrapper(_document.CreateAttribute(qualifiedName, namespaceURI));

            xmlNodeWrapper.Value = value;
            return(xmlNodeWrapper);
        }
예제 #3
0
        public IXmlNode CreateAttribute(string name, string value)
        {
            XmlNodeWrapper xmlNodeWrapper = new XmlNodeWrapper(_document.CreateAttribute(name));

            xmlNodeWrapper.Value = value;
            return(xmlNodeWrapper);
        }
예제 #4
0
        /// <summary>
        /// Writes the JSON representation of the object.
        /// </summary>
        /// <param name="writer">The <see cref="JsonWriter"/> to write to.</param>
        /// <param name="serializer">The calling serializer.</param>
        /// <param name="value">The value.</param>
        public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
        {
            IXmlNode node;

            if (value is XmlNode)
            {
                node = new XmlNodeWrapper((XmlNode)value);
            }
#if !NET20
            else if (value is XObject)
            {
                node = XContainerWrapper.WrapNode((XObject)value);
            }
#endif
            else
            {
                throw new ArgumentException("Value must be an XmlNode", "value");
            }

            XmlNamespaceManager manager = new XmlNamespaceManager(new NameTable());
            PushParentNamespaces(node, manager);

            writer.WriteStartObject();
            SerializeNode(writer, node, manager, true);
            writer.WriteEndObject();
        }
        public IXmlNode CreateAttribute(string name, string value)
        {
            XmlNodeWrapper attribute = new XmlNodeWrapper(_document.CreateAttribute(name));

            attribute.Value = value;

            return(attribute);
        }
예제 #6
0
        public IXmlNode AppendChild(IXmlNode newChild)
        {
            XmlNodeWrapper xmlNodeWrapper = (XmlNodeWrapper)newChild;

            this._node.AppendChild(xmlNodeWrapper._node);
            this._childNodes = null;
            this._attributes = null;
            return(newChild);
        }
예제 #7
0
 private IXmlNode WrapXml(object value)
 {
     if (value is XObject)
     {
         return(XContainerWrapper.WrapNode((XObject)value));
     }
     if (!(value is System.Xml.XmlNode))
     {
         throw new ArgumentException("Value must be an XML object.", "value");
     }
     return(XmlNodeWrapper.WrapNode((System.Xml.XmlNode)value));
 }
예제 #8
0
        private IXmlNode WrapXml(object value)
        {
            switch (value)
            {
            case XObject _:
                return(XContainerWrapper.WrapNode((XObject)value));

            case XmlNode _:
                return(XmlNodeWrapper.WrapNode((XmlNode)value));

            default:
                throw new ArgumentException("Value must be an XML object.", nameof(value));
            }
        }
예제 #9
0
    public IXmlNode CreateAttribute(string name, string value)
    {
      XmlNodeWrapper attribute = new XmlNodeWrapper(_document.CreateAttribute(name));
      attribute.Value = value;

      return attribute;
    }
예제 #10
0
    public IXmlNode CreateAttribute(string qualifiedName, string namespaceUri, string value)
    {
      XmlNodeWrapper attribute = new XmlNodeWrapper(_document.CreateAttribute(qualifiedName, namespaceUri));
      attribute.Value = value;

      return attribute;
    }
예제 #11
0
        public void SetAttributeNode(IXmlNode attribute)
        {
            XmlNodeWrapper xmlAttributeWrapper = (XmlNodeWrapper)attribute;

            _element.SetAttributeNode((XmlAttribute)xmlAttributeWrapper.WrappedNode);
        }
예제 #12
0
        public void SetAttributeNode(IXmlNode attribute)
        {
            XmlNodeWrapper wrapper = (XmlNodeWrapper)attribute;

            this._element.SetAttributeNode((System.Xml.XmlAttribute)wrapper.WrappedNode);
        }
예제 #13
0
    /// <summary>
    /// Writes the JSON representation of the object.
    /// </summary>
    /// <param name="writer">The <see cref="JsonWriter"/> to write to.</param>
    /// <param name="serializer">The calling serializer.</param>
    /// <param name="value">The value.</param>
    public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
    {
      IXmlNode node;

      if (value is XmlNode)
        node = new XmlNodeWrapper((XmlNode)value);
#if !NET20
      else if (value is XObject)
        node = XContainerWrapper.WrapNode((XObject)value);
#endif
      else
        throw new ArgumentException("Value must be an XmlNode", "value");

      XmlNamespaceManager manager = new XmlNamespaceManager(new NameTable());
      PushParentNamespaces(node, manager);

      writer.WriteStartObject();
      SerializeNode(writer, node, manager, true);
      writer.WriteEndObject();
    }