【问题标题】:Manipulation of XML Attribute datetimeXML 属性 datetime 的操作
【发布时间】:2018-07-14 11:23:38
【问题描述】:

我可以序列化 XML 字符串。但是我不能像这样为日期时间创建 XML 属性

<StartDate xsi:type=xsd:dateTime>datevalue</StartDate> 

我正在使用 c# 类来表示 XML 元素。

我无法生成 xsi:type 属性。

我想以编程方式创建它,我该怎么做?

【问题讨论】:

    标签: c# xml http soap


    【解决方案1】:
    public DateRange()
    {
        type = "xsd:dateTime";
    }
    
    [XmlAttribute(Namespace = "http://www.w3.org/2001/XMLSchema-instance", AttributeName = "type")]
    public string type { get; set; }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-04-08
      • 1970-01-01
      • 2012-05-03
      • 1970-01-01
      • 2011-02-20
      • 1970-01-01
      • 2012-03-14
      • 1970-01-01
      相关资源
      最近更新 更多