Example #1
0
        public IXmlNode AppendChild(IXmlNode newChild)
        {
            XmlNodeWrapper xmlNodeWrapper = (XmlNodeWrapper)newChild;

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

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

            xmlNodeWrapper.Value = value;
            return(xmlNodeWrapper);
        }
Example #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);
        }
Example #6
0
        public IXmlNode AppendChild(IXmlNode newChild)
        {
            XmlNodeWrapper xmlNodeWrapper = (XmlNodeWrapper)newChild;

            this._node.AppendChild(xmlNodeWrapper._node);
            this._childNodes = null;
            this._attributes = null;
            return(newChild);
        }
Example #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));
 }
        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));
            }
        }
Example #9
0
    public IXmlNode CreateAttribute(string name, string value)
    {
      XmlNodeWrapper attribute = new XmlNodeWrapper(_document.CreateAttribute(name));
      attribute.Value = value;

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

      return attribute;
    }
        public void SetAttributeNode(IXmlNode attribute)
        {
            XmlNodeWrapper xmlAttributeWrapper = (XmlNodeWrapper)attribute;

            _element.SetAttributeNode((XmlAttribute)xmlAttributeWrapper.WrappedNode);
        }
        public void SetAttributeNode(IXmlNode attribute)
        {
            XmlNodeWrapper wrapper = (XmlNodeWrapper)attribute;

            this._element.SetAttributeNode((System.Xml.XmlAttribute)wrapper.WrappedNode);
        }
Example #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();
    }