/// <summary> /// Saves the current <see cref="YahooMediaTextConstruct"/> to the specified <see cref="XmlWriter"/>. /// </summary> /// <param name="writer">The <see cref="XmlWriter"/> to which you want to save.</param> /// <param name="elementName">The local name of the text construct being written.</param> /// <exception cref="ArgumentNullException">The <paramref name="writer"/> is a null reference (Nothing in Visual Basic).</exception> public void WriteTo(XmlWriter writer, string elementName) { //------------------------------------------------------------ // Validate parameter //------------------------------------------------------------ Guard.ArgumentNotNull(writer, "writer"); //------------------------------------------------------------ // Create extension instance to retrieve XML namespace //------------------------------------------------------------ YahooMediaSyndicationExtension extension = new YahooMediaSyndicationExtension(); //------------------------------------------------------------ // Write XML representation of the current instance //------------------------------------------------------------ writer.WriteStartElement(elementName, extension.XmlNamespace); if (this.TextType != YahooMediaTextConstructType.None) { writer.WriteAttributeString("type", YahooMediaTextConstruct.TextTypeAsString(this.TextType)); } if (!String.IsNullOrEmpty(this.Content)) { writer.WriteString(this.Content); } writer.WriteEndElement(); }
/// <summary> /// Saves the current <see cref="YahooMediaTextConstruct"/> to the specified <see cref="XmlWriter"/>. /// </summary> /// <param name="writer">The <see cref="XmlWriter"/> to which you want to save.</param> /// <param name="elementName">The local name of the text construct being written.</param> /// <exception cref="ArgumentNullException">The <paramref name="writer"/> is a null reference (Nothing in Visual Basic).</exception> public void WriteTo(XmlWriter writer, string elementName) { Guard.ArgumentNotNull(writer, "writer"); YahooMediaSyndicationExtension extension = new YahooMediaSyndicationExtension(); writer.WriteStartElement(elementName, extension.XmlNamespace); if (this.TextType != YahooMediaTextConstructType.None) { writer.WriteAttributeString("type", YahooMediaTextConstruct.TextTypeAsString(this.TextType)); } if (!String.IsNullOrEmpty(this.Content)) { writer.WriteString(this.Content); } writer.WriteEndElement(); }