Exemple #1
0
        /// <summary>
        /// Serialize this object to the given serializer.
        /// </summary>
        public override void WriteTo(IXmlSerializer serializer)
        {
            serializer.StartTag(name.NamespaceName, name.LocalName);

            if (HasAttributes)
            {
                foreach (var attr in Attributes())
                {
                    attr.WriteTo(serializer);
                }
            }

            if (content is string)
            {
                serializer.Text((string)content);
            }
            else if (content is XNode)
            {
                foreach (var node in Nodes())
                {
                    node.WriteTo(serializer);
                }
            }

            serializer.EndTag(name.NamespaceName, name.LocalName);
        }
Exemple #2
0
        /// <summary>
        /// Serialize this object to the given serializer.
        /// </summary>
        public override void WriteTo(IXmlSerializer serializer)
        {
            serializer.StartTag(name.NamespaceName, name.LocalName);

            if (HasAttributes)
            {
                foreach (var attr in Attributes())
                {
                    attr.WriteTo(serializer);
                }
            }

            if (content is string)
            {
                serializer.Text((string) content);
            }
            else if (content is XNode)
            {
                foreach (var node in Nodes())
                {
                    node.WriteTo(serializer);
                }
            }

            serializer.EndTag(name.NamespaceName, name.LocalName);
        }