MarketplaceWebServiceProducts.Model.Product.ToXMLFragment C# (CSharp) Method

ToXMLFragment() protected method

XML fragment representation of this object
Name for outer tag expected to be set by calling method. This fragment returns inner properties representation only
protected ToXMLFragment ( ) : String
return String
        protected internal String ToXMLFragment()
        {
            StringBuilder xml = new StringBuilder();
            if (IsSetIdentifiers()) {
                IdentifierType  identifiersObj = this.Identifiers;
                xml.Append("<Identifiers>");
                xml.Append(identifiersObj.ToXMLFragment());
                xml.Append("</Identifiers>");
            }
            if (IsSetAttributeSets()) {
                AttributeSetList  attributeSetsObj = this.AttributeSets;
                xml.Append("<AttributeSets>");
                xml.Append(attributeSetsObj.ToXMLFragment());
                xml.Append("</AttributeSets>");
            }
            if (IsSetRelationships()) {
                RelationshipList  relationshipsObj = this.Relationships;
                xml.Append("<Relationships>");
                xml.Append(relationshipsObj.ToXMLFragment());
                xml.Append("</Relationships>");
            }
            if (IsSetCompetitivePricing()) {
                CompetitivePricingType  competitivePricingObj = this.CompetitivePricing;
                xml.Append("<CompetitivePricing>");
                xml.Append(competitivePricingObj.ToXMLFragment());
                xml.Append("</CompetitivePricing>");
            }
            if (IsSetSalesRankings()) {
                SalesRankList  salesRankingsObj = this.SalesRankings;
                xml.Append("<SalesRankings>");
                xml.Append(salesRankingsObj.ToXMLFragment());
                xml.Append("</SalesRankings>");
            }
            if (IsSetLowestOfferListings()) {
                LowestOfferListingList  lowestOfferListingsObj = this.LowestOfferListings;
                xml.Append("<LowestOfferListings>");
                xml.Append(lowestOfferListingsObj.ToXMLFragment());
                xml.Append("</LowestOfferListings>");
            }
            if (IsSetOffers()) {
                OffersList  offersObj = this.Offers;
                xml.Append("<Offers>");
                xml.Append(offersObj.ToXMLFragment());
                xml.Append("</Offers>");
            }
            return xml.ToString();
        }

Usage Example

        /// <summary>
        /// XML fragment representation of this object
        /// </summary>
        /// <returns>XML fragment for this object.</returns>
        /// <remarks>
        /// Name for outer tag expected to be set by calling method.
        /// This fragment returns inner properties representation only
        /// </remarks>


        protected internal String ToXMLFragment()
        {
            StringBuilder xml = new StringBuilder();

            if (IsSetAllOfferListingsConsidered())
            {
                xml.Append("<AllOfferListingsConsidered>");
                xml.Append(this.AllOfferListingsConsidered);
                xml.Append("</AllOfferListingsConsidered>");
            }
            if (IsSetProduct())
            {
                Product productObj = this.Product;
                xml.Append("<Product>");
                xml.Append(productObj.ToXMLFragment());
                xml.Append("</Product>");
            }
            if (IsSetError())
            {
                Error errorObj = this.Error;
                xml.Append("<Error>");
                xml.Append(errorObj.ToXMLFragment());
                xml.Append("</Error>");
            }
            return(xml.ToString());
        }