Beispiel #1
0
        /// <summary>
        /// Persistence method for the Who object
        /// </summary>
        /// <param name="writer">the xmlwriter to write into</param>
        public void Save(XmlWriter writer)
        {
            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }

            if (Utilities.IsPersistable(Rel) ||
                Utilities.IsPersistable(_valueString) ||
                Utilities.IsPersistable(_email) ||
                _attendeeType != null ||
                _attendeeStatus != null ||
                _entryLink != null)
            {
                writer.WriteStartElement(BaseNameTable.gDataPrefix, XmlName, BaseNameTable.gNamespace);

                if (Utilities.IsPersistable(Rel))
                {
                    writer.WriteAttributeString(GDataParserNameTable.XmlAttributeRel, Rel);
                }
                else
                {
                    throw new ClientFeedException("g:who/@rel is required.");
                }

                if (Utilities.IsPersistable(_valueString))
                {
                    writer.WriteAttributeString(GDataParserNameTable.XmlAttributeValueString, _valueString);
                }

                if (Utilities.IsPersistable(_email))
                {
                    writer.WriteAttributeString(GDataParserNameTable.XmlAttributeEmail, _email);
                }

                if (_attendeeType != null)
                {
                    _attendeeType.Save(writer);
                }

                if (_attendeeStatus != null)
                {
                    _attendeeStatus.Save(writer);
                }

                if (_entryLink != null)
                {
                    _entryLink.Save(writer);
                }

                writer.WriteEndElement();
            }
        }
        /// <summary>
        /// Persistence method for the Where object
        /// </summary>
        /// <param name="writer">the xmlwriter to write into</param>
        public void Save(XmlWriter writer)
        {
            writer.WriteStartElement(BaseNameTable.gDataPrefix, XmlName, BaseNameTable.gNamespace);

            writer.WriteAttributeString(GDataParserNameTable.XmlAttributeValueString, _valueString);

            if (Utilities.IsPersistable(Label))
            {
                writer.WriteAttributeString(GDataParserNameTable.XmlAttributeLabel, Label);
            }

            if (Utilities.IsPersistable(Rel))
            {
                writer.WriteAttributeString(GDataParserNameTable.XmlAttributeRel, Rel);
            }

            if (_entryLink != null)
            {
                _entryLink.Save(writer);
            }

            writer.WriteEndElement();
        }