好的,所以我正在尝试使用ebay LMS创建一个xml文件来更新库存物品。
我无法输出Feed文件的这一部分:
<ReviseInventoryStatusRequest xmlns="urn:ebay:apis:eBLBaseComponents">
这是我到目前为止的代码:
using (var writer = XmlWriter.Create(stream, settings))
{
writer.WriteStartDocument();
writer.WriteStartElement("ReviseInventoryStatusRequest");
writer.WriteStartAttribute("xmlns", "urn:ebay:apis:eBLBaseComponents");
writer.WriteEndAttribute();
writer.WriteStartElement("RequesterCredentials");
writer.WriteElementString("eBayAuthToken", ebayAuthTokenSetting.ToString());
writer.WriteEndElement();
writer.WriteElementString("Version", "967");
writer.WriteElementString("ErrorLanguage", "en_US");
writer.WriteElementString("WarningLevel", "High");
//int counter = 1;
//Add the products to feed which do not have variations
foreach (var ep in productsToProcess)
{
var product = _productService.GetProductById(ep.ProductID);
var productStockQuantity = product.GetTotalStockQuantity();
if (product.GetTotalStockQuantity() != productStockQuantity) {
writer.WriteStartElement("InventoryStatus");
writer.WriteElementString("SKU", ep.EbayProductSKU);
writer.WriteElementString("ItemID", ep.EbayID);
writer.WriteElementString("Quantity", productStockQuantity.ToString());
writer.WriteEndElement();
//ep.EbayProductStockQuantity = productStockQuantity;
//_ebayProductService.UpdateEbayProduct(ep);
sendEbayApiRequest = true;
}
}
writer.WriteEndElement(); // ReviseInventoryStatusRequest
writer.WriteEndDocument(); // productfeed
}
我试过这个输出文件的那一部分:
writer.WriteStartAttribute("xmlns", "urn:ebay:apis:eBLBaseComponents");
writer.WriteEndAttribute();
还试过这个:
writer.WriteAttributeString("xmlns", null, "urn:ebay:apis:eBLBaseComponents", null);
以上代码段的其他变体如:
writer.WriteAttributeString(null, "xmlns", null, "urn:ebay:apis:eBLBaseComponents");
我有点迷失如何做到这一点,我看到了一些例子,但没有帮助。
任何人都可以提供帮助,谢谢。
答案 0 :(得分:1)
好的,感谢@dbc的帮助,我不得不使用以下代码。
DWORD*
哪个输出
writer.WriteStartElement("ReviseInventoryStatusRequest", "urn:ebay:apis:eBLBaseComponents");
谢谢@dbc