Exemplo n.º 1
0
        /// <summary>
        /// Converts an object into its XML representation.
        /// The parent node must exist, for example, use IXmlSerializable interface
        /// </summary>
        /// <param name="n">the node to serialize</param>
        /// <param name="writer">XML writer used to write the XML document.</param>
        internal static void XMLSerialize(DDNode n, XmlWriter writer)
        {
            if (n.Name != null)
            {
                writer.WriteAttributeString(DDSchema.XML_SERIALIZE_ATTRIBUTE_NAME, n.Name);
            }
            if (String.IsNullOrEmpty(n.Type) == false)
            {
                writer.WriteAttributeString(DDSchema.XML_SERIALIZE_ATTRIBUTE_TYPE, n.Type);                                        // write none empty type
            }
            if (n.Attributes != null)
            {
                DDAttributesCollectionSxe.XMLSerialize(n.Attributes, writer);
            }

            if (n.HasChildNodes)
            {
                foreach (var keyValuePair in n)
                {
                    if (keyValuePair.Value != null)
                    {
                        keyValuePair.Value.Serialize(writer);
                    }
                }
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Generates an object from its XML representation.
 /// </summary>
 /// <param name="reader"></param>
 public virtual void ReadXml(XmlReader reader)
 {
     this.ac = DDAttributesCollectionSxe.Deserialize(reader);
 }
Exemplo n.º 3
0
 /// <summary>
 /// Converts an object into its XML representation.
 /// </summary>
 /// <param name="writer"></param>
 public virtual void WriteXml(XmlWriter writer)
 {
     DDAttributesCollectionSxe.XMLSerialize(this.ac, writer);
 }