private static string GetProductAttribute( GetMatchingProductForIdResponse response, string path ) { var xmlElement = ( XmlElement ) response.GetMatchingProductForIdResult[ 0 ].Products.Product[ 0 ].AttributeSets.Any[ 0 ]; var xmlContent = ProductsUtil.FormatXml( xmlElement ); var xmlDoc = new XmlDocument { InnerXml = xmlContent, }; var namespaceManager = new XmlNamespaceManager( xmlDoc.NameTable ); namespaceManager.AddNamespace( "ns2", "http://mws.amazonservices.com/schema/Products/2011-10-01/default.xsd" ); var itemIdNode = xmlDoc.SelectSingleNode( path, namespaceManager ); return itemIdNode != null ? itemIdNode.InnerText : null; }
private static string GetProductTitle( GetMatchingProductForIdResponse response ) { return GetProductAttribute( response, "/ns2:ItemAttributes/ns2:Title" ); }
private static string GetProductSmallImageUrl( GetMatchingProductForIdResponse response ) { return GetProductAttribute( response, "/ns2:ItemAttributes/ns2:SmallImage/ns2:URL" ); }
private static string GeProductAsinId( GetMatchingProductForIdResponse response ) { return response.GetMatchingProductForIdResult[ 0 ].Products.Product[ 0 ].Identifiers.MarketplaceASIN.ASIN; }
private static void CheckForErrors( GetMatchingProductForIdResponse response ) { if( response.GetMatchingProductForIdResult[ 0 ].IsSetError() ) { throw new SpreadbotException( response.ToXML() ); } }