嗨,我有 3 个这样的课程:
public abstract class XmlNs
{
public const string XmlnsAttribute = "urn:ebay:apis:eBLBaseComponents";
}
[Serializable]
public class BulkDataExchangeRequests : XmlNs
{
[XmlAttribute("xmlns")]
public string XmlNs = XmlnsAttribute;
[XmlElement("Header")]
public Header Header { get; set; }
[XmlElement("AddFixedPriceItemRequest")]
public List<AddFixedPriceItemRequest> ListAddFixedPriceItemRequest { get; set; }
}
[Serializable]
public class AddFixedPriceItemRequest : XmlNs
{
[XmlElement("ErrorLanguage")]
public string ErrorLanguage { get; set; }
[XmlElement("WarningLevel")]
public string WarningLevel { get; set; }
[XmlElement("Version")]
public string Version { get; set; }
[XmlElement("Item")]
public ItemType Item { get; set; }
[XmlAttribute("xmlns")]
public string XmlNs = XmlnsAttribute;
}
问题是,当我序列化对象时,我得到了正确的 xml,但 AddFixedPriceItemRequest 项中没有 xmlns 属性,而在 BulkDataExchangeRequests 中,xmlns 被正确写入......
任何帮助将不胜感激...