Esempio n. 1
0
        // Writes the start of the element (and its attributes) to the specified writer
        private void WriteStartElement(XmlWriter w)
        {
            w.WriteStartElement(Prefix, LocalName, NamespaceURI);

            if (HasAttributes)
            {
                XmlAttributeCollection attrs = Attributes;
                for (int i = 0; i < attrs.Count; i += 1)
                {
                    XmlAttribute attr = attrs[i];
                    attr.WriteTo(w);
                }
            }
        }
Esempio n. 2
0
        // Saves the current node to the specified XmlWriter.
        public override void WriteTo(XmlWriter w)
        {
            w.WriteStartElement(Prefix, LocalName, NamespaceURI);

            if (HasAttributes)
            {
                XmlAttributeCollection attrs = Attributes;
                for (int i = 0; i < attrs.Count; i += 1)
                {
                    XmlAttribute attr = attrs[i];
                    attr.WriteTo(w);
                }
            }

            if (IsEmpty)
            {
                w.WriteEndElement();
            }
            else
            {
                WriteContentTo(w);
                w.WriteFullEndElement();
            }
        }