如何仅使用类型安全的C#类读取XML?我必须学习XML的哪些方面?
我见过一种只使用C类名称而不使用明显的如何仅使用类型安全的C#类读取XML?我必须学习XML的哪些方面?,c#,xml,serialization,xml-serialization,xsd.exe,C#,Xml,Serialization,Xml Serialization,Xsd.exe,我见过一种只使用C类名称而不使用明显的属性[]将XML读写到磁盘的技术 这称为什么,如何将其应用于如下所示的数据集: <?xml version="1.0"?> <feedback> <report_metadata> <org_name>Yahoo! Inc.</org_name> <email>postmaster@dmarc.yahoo.com</email>
属性[]
将XML读写到磁盘的技术
这称为什么,如何将其应用于如下所示的数据集:
<?xml version="1.0"?>
<feedback>
<report_metadata>
<org_name>Yahoo! Inc.</org_name>
<email>postmaster@dmarc.yahoo.com</email>
<report_id>1340012067.929728</report_id>
<date_range>
<begin>1339891200</begin>
<end>1339977599 </end>
</date_range>
</report_metadata>
<policy_published>
<domain>company.com</domain>
<adkim>r</adkim>
<aspf>r</aspf>
<p>none</p>
<pct>100</pct>
</policy_published>
<record>
<row>
<source_ip>123.18.181.64</source_ip>
<count>1</count>
<policy_evaluated>
<disposition>none</disposition>
<dkim>fail</dkim>
<spf>fail</spf>
</policy_evaluated>
</row>
<identifiers>
<header_from>company.com</header_from>
</identifiers>
<auth_results>
<dkim>
<domain>company.com</domain>
<result>neutral</result>
</dkim>
<spf>
<domain>company.com</domain>
<result>softfail</result>
</spf>
</auth_results>
</record>
</feedback>
然后运行这个命令来获取CS文件
C:\Temp>xsd test.xsd /c /language:cs
Microsoft (R) Xml Schemas/DataTypes support utility
[Microsoft (R) .NET Framework, Version 4.0.30319.1]
Copyright (C) Microsoft Corporation. All rights reserved.
Writing file 'C:\Temp\test.cs'.
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.544
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System.Xml.Serialization;
//
// This source code was auto-generated by xsd, Version=4.0.30319.1.
//
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
[System.Xml.Serialization.XmlRootAttribute(Namespace = "", IsNullable = false)]
public partial class feedback
{
private object[] itemsField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("policy_published", typeof(feedbackPolicy_published), Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
[System.Xml.Serialization.XmlElementAttribute("record", typeof(feedbackRecord), Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
[System.Xml.Serialization.XmlElementAttribute("report_metadata", typeof(feedbackReport_metadata), Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public object[] Items
{
get
{
return this.itemsField;
}
set
{
this.itemsField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
public partial class feedbackPolicy_published
{
private string domainField;
private string adkimField;
private string aspfField;
private string pField;
private string pctField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string domain
{
get
{
return this.domainField;
}
set
{
this.domainField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string adkim
{
get
{
return this.adkimField;
}
set
{
this.adkimField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string aspf
{
get
{
return this.aspfField;
}
set
{
this.aspfField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string p
{
get
{
return this.pField;
}
set
{
this.pField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string pct
{
get
{
return this.pctField;
}
set
{
this.pctField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
public partial class feedbackRecord
{
private feedbackRecordRow[] rowField;
private feedbackRecordIdentifiers[] identifiersField;
private feedbackRecordAuth_results[] auth_resultsField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("row", Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public feedbackRecordRow[] row
{
get
{
return this.rowField;
}
set
{
this.rowField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("identifiers", Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public feedbackRecordIdentifiers[] identifiers
{
get
{
return this.identifiersField;
}
set
{
this.identifiersField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("auth_results", Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public feedbackRecordAuth_results[] auth_results
{
get
{
return this.auth_resultsField;
}
set
{
this.auth_resultsField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
public partial class feedbackRecordRow
{
private string source_ipField;
private string countField;
private feedbackRecordRowPolicy_evaluated[] policy_evaluatedField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string source_ip
{
get
{
return this.source_ipField;
}
set
{
this.source_ipField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string count
{
get
{
return this.countField;
}
set
{
this.countField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("policy_evaluated", Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public feedbackRecordRowPolicy_evaluated[] policy_evaluated
{
get
{
return this.policy_evaluatedField;
}
set
{
this.policy_evaluatedField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
public partial class feedbackRecordRowPolicy_evaluated
{
private string dispositionField;
private string dkimField;
private string spfField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string disposition
{
get
{
return this.dispositionField;
}
set
{
this.dispositionField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string dkim
{
get
{
return this.dkimField;
}
set
{
this.dkimField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string spf
{
get
{
return this.spfField;
}
set
{
this.spfField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
public partial class feedbackRecordIdentifiers
{
private string header_fromField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string header_from
{
get
{
return this.header_fromField;
}
set
{
this.header_fromField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
public partial class feedbackRecordAuth_results
{
private feedbackRecordAuth_resultsDkim[] dkimField;
private feedbackRecordAuth_resultsSpf[] spfField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("dkim", Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public feedbackRecordAuth_resultsDkim[] dkim
{
get
{
return this.dkimField;
}
set
{
this.dkimField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("spf", Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public feedbackRecordAuth_resultsSpf[] spf
{
get
{
return this.spfField;
}
set
{
this.spfField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
public partial class feedbackRecordAuth_resultsDkim
{
private string domainField;
private string resultField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string domain
{
get
{
return this.domainField;
}
set
{
this.domainField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string result
{
get
{
return this.resultField;
}
set
{
this.resultField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
public partial class feedbackRecordAuth_resultsSpf
{
private string domainField;
private string resultField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string domain
{
get
{
return this.domainField;
}
set
{
this.domainField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string result
{
get
{
return this.resultField;
}
set
{
this.resultField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
public partial class feedbackReport_metadata
{
private string org_nameField;
private string emailField;
private string report_idField;
private feedbackReport_metadataDate_range[] date_rangeField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string org_name
{
get
{
return this.org_nameField;
}
set
{
this.org_nameField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string email
{
get
{
return this.emailField;
}
set
{
this.emailField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string report_id
{
get
{
return this.report_idField;
}
set
{
this.report_idField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("date_range", Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public feedbackReport_metadataDate_range[] date_range
{
get
{
return this.date_rangeField;
}
set
{
this.date_rangeField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
public partial class feedbackReport_metadataDate_range
{
private string beginField;
private string endField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string begin
{
get
{
return this.beginField;
}
set
{
this.beginField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string end
{
get
{
return this.endField;
}
set
{
this.endField = value;
}
}
}
C:\Temp>xsd test.xsd /c /language:cs
Microsoft (R) Xml Schemas/DataTypes support utility
[Microsoft (R) .NET Framework, Version 4.0.30319.1]
Copyright (C) Microsoft Corporation. All rights reserved.
Writing file 'C:\Temp\test.cs'.
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.544
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System.Xml.Serialization;
//
// This source code was auto-generated by xsd, Version=4.0.30319.1.
//
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
[System.Xml.Serialization.XmlRootAttribute(Namespace = "", IsNullable = false)]
public partial class feedback
{
private object[] itemsField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("policy_published", typeof(feedbackPolicy_published), Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
[System.Xml.Serialization.XmlElementAttribute("record", typeof(feedbackRecord), Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
[System.Xml.Serialization.XmlElementAttribute("report_metadata", typeof(feedbackReport_metadata), Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public object[] Items
{
get
{
return this.itemsField;
}
set
{
this.itemsField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
public partial class feedbackPolicy_published
{
private string domainField;
private string adkimField;
private string aspfField;
private string pField;
private string pctField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string domain
{
get
{
return this.domainField;
}
set
{
this.domainField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string adkim
{
get
{
return this.adkimField;
}
set
{
this.adkimField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string aspf
{
get
{
return this.aspfField;
}
set
{
this.aspfField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string p
{
get
{
return this.pField;
}
set
{
this.pField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string pct
{
get
{
return this.pctField;
}
set
{
this.pctField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
public partial class feedbackRecord
{
private feedbackRecordRow[] rowField;
private feedbackRecordIdentifiers[] identifiersField;
private feedbackRecordAuth_results[] auth_resultsField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("row", Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public feedbackRecordRow[] row
{
get
{
return this.rowField;
}
set
{
this.rowField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("identifiers", Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public feedbackRecordIdentifiers[] identifiers
{
get
{
return this.identifiersField;
}
set
{
this.identifiersField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("auth_results", Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public feedbackRecordAuth_results[] auth_results
{
get
{
return this.auth_resultsField;
}
set
{
this.auth_resultsField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
public partial class feedbackRecordRow
{
private string source_ipField;
private string countField;
private feedbackRecordRowPolicy_evaluated[] policy_evaluatedField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string source_ip
{
get
{
return this.source_ipField;
}
set
{
this.source_ipField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string count
{
get
{
return this.countField;
}
set
{
this.countField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("policy_evaluated", Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public feedbackRecordRowPolicy_evaluated[] policy_evaluated
{
get
{
return this.policy_evaluatedField;
}
set
{
this.policy_evaluatedField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
public partial class feedbackRecordRowPolicy_evaluated
{
private string dispositionField;
private string dkimField;
private string spfField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string disposition
{
get
{
return this.dispositionField;
}
set
{
this.dispositionField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string dkim
{
get
{
return this.dkimField;
}
set
{
this.dkimField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string spf
{
get
{
return this.spfField;
}
set
{
this.spfField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
public partial class feedbackRecordIdentifiers
{
private string header_fromField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string header_from
{
get
{
return this.header_fromField;
}
set
{
this.header_fromField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
public partial class feedbackRecordAuth_results
{
private feedbackRecordAuth_resultsDkim[] dkimField;
private feedbackRecordAuth_resultsSpf[] spfField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("dkim", Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public feedbackRecordAuth_resultsDkim[] dkim
{
get
{
return this.dkimField;
}
set
{
this.dkimField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("spf", Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public feedbackRecordAuth_resultsSpf[] spf
{
get
{
return this.spfField;
}
set
{
this.spfField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
public partial class feedbackRecordAuth_resultsDkim
{
private string domainField;
private string resultField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string domain
{
get
{
return this.domainField;
}
set
{
this.domainField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string result
{
get
{
return this.resultField;
}
set
{
this.resultField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
public partial class feedbackRecordAuth_resultsSpf
{
private string domainField;
private string resultField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string domain
{
get
{
return this.domainField;
}
set
{
this.domainField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string result
{
get
{
return this.resultField;
}
set
{
this.resultField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
public partial class feedbackReport_metadata
{
private string org_nameField;
private string emailField;
private string report_idField;
private feedbackReport_metadataDate_range[] date_rangeField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string org_name
{
get
{
return this.org_nameField;
}
set
{
this.org_nameField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string email
{
get
{
return this.emailField;
}
set
{
this.emailField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string report_id
{
get
{
return this.report_idField;
}
set
{
this.report_idField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("date_range", Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public feedbackReport_metadataDate_range[] date_range
{
get
{
return this.date_rangeField;
}
set
{
this.date_rangeField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
public partial class feedbackReport_metadataDate_range
{
private string beginField;
private string endField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string begin
{
get
{
return this.beginField;
}
set
{
this.beginField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string end
{
get
{
return this.endField;
}
set
{
this.endField = value;
}
}
}
C:\Temp>xsd test.xsd/C/language:cs
Microsoft(R)Xml架构/数据类型支持实用程序
[Microsoft(R).NET Framework,版本4.0.30319.1]
版权所有(C)微软公司。版权所有。
正在写入文件“C:\Temp\test.cs”。
//------------------------------------------------------------------------------
//
//这段代码是由一个工具生成的。
//运行时版本:4.0.30319.544
//
//对此文件的更改可能会导致不正确的行为,如果
//重新生成代码。
//
//------------------------------------------------------------------------------
使用System.Xml.Serialization;
//
//此源代码由xsd自动生成,版本=4.0.30319.1。
//
///
[System.CodeDom.Compiler.GeneratedCodeAttribute(“xsd”,“4.0.30319.1”)]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute(“代码”)]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true)]
[System.Xml.Serialization.XmlRootAttribute(Namespace=”“,IsNullable=false)]
公开部分课堂反馈
{
私有对象[]项字段;
///
[System.Xml.Serialization.xmlementAttribute(“policy_published”,typeof(feedbackPolicy_published),Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
[System.Xml.Serialization.xmlementAttribute(“记录”,typeof(feedbackRecord),Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
[System.Xml.Serialization.xmlementAttribute(“报告元数据”,类型(反馈报告元数据),Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
公共对象[]项
{
得到
{
返回此.itemsField;
}
设置
{
this.itemsField=值;
}
}
}
///
[System.CodeDom.Compiler.GeneratedCodeAttribute(“xsd”,“4.0.30319.1”)]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute(“代码”)]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true)]
公共部分类反馈政策公布
{
私有字符串域;
私有字符串阿德金菲尔德;
私人字符串aspfField;
私有字符串字段;
私有字符串pctField;
///
[System.Xml.Serialization.xmlementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
公共字符串域
{
得到
{
返回此.domainField;
}
设置
{
this.domainField=值;
}
}
///
[System.Xml.Serialization.xmlementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
公共字符串adkim
{
得到
{
归还这个。阿德金菲尔德;
}
设置
{
this.adkimField=值;
}
}
///
[System.Xml.Serialization.xmlementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
公共字符串aspf
{
得到
{
返回此文件。aspfield;
}
设置
{
this.aspfField=值;
}
}
///
[System.Xml.Serialization.xmlementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
公共字符串p
{
得到
{
返回此.pField;
}
设置
{
this.pField=值;
}
}
///
[System.Xml.Serialization.xmlementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
公共字符串pct
{
得到
{
返回此.pctField;
}
设置
{
this.pctField=值;
}
}
}
///
[System.CodeDom.Compiler.GeneratedCodeAttribute(“xsd”,“4.0.30319.1”)]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute(“代码”)]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true)]
公共部分类反馈记录
{
私有反馈记录行[]行字段;
私有反馈记录标识符[]标识符字段;
私有反馈记录auth_results[]auth_results字段;
///
[System.Xml.Serialization.xmlementAttribute(“行”,Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
公共反馈记录行[]行
{
得到
{
把这个还给我。罗菲尔德;
}
设置
{
this.rowField=值;
}
}
///
[System.Xml.Serialization.xmlementAttribute(“标识符”,Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
公共反馈记录标识符[]标识符
{
得到
{
返回此.identifiersField;
}
设置
{
this.identifiersField=值;
}
}
///
[System.Xml.Serialization.xmlementAttribute(“auth_results”,Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
公共反馈记录验证结果[]验证结果
{
得到
{
返回this.auth_resultsField;
}
设置
{
this.auth_resultsField=值;
}
}
}
///
[System.CodeDom.Compiler.GeneratedCodeAttribute(“xsd”,“4.0.30319.1”)]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute(“代码”)]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true)]
公共部分类反馈记录行
{
私有字符串源字段;
私有字符串countField;
私有反馈记录RowPolicy\u evaluated[]策略\u evaluatedField;
///
[System.Xml.Serialization.XmlElementAttri]
XmlDocument doc = new XmlDocument();
doc.Load("Test.xml");
XmlElement root = doc.DocumentElement;
//Preform your read and write operation here
doc.Save("Test.xml");
C:\Temp>xsd test.xml /c /language:cs /out:c:\temp
Microsoft (R) Xml Schemas/DataTypes support utility
[Microsoft (R) .NET Framework, Version 4.0.30319.1]
Copyright (C) Microsoft Corporation. All rights reserved.
Writing file 'c:\temp\test.xsd'.
C:\Temp>xsd test.xsd /c /language:cs
Microsoft (R) Xml Schemas/DataTypes support utility
[Microsoft (R) .NET Framework, Version 4.0.30319.1]
Copyright (C) Microsoft Corporation. All rights reserved.
Writing file 'C:\Temp\test.cs'.
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.544
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System.Xml.Serialization;
//
// This source code was auto-generated by xsd, Version=4.0.30319.1.
//
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
[System.Xml.Serialization.XmlRootAttribute(Namespace = "", IsNullable = false)]
public partial class feedback
{
private object[] itemsField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("policy_published", typeof(feedbackPolicy_published), Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
[System.Xml.Serialization.XmlElementAttribute("record", typeof(feedbackRecord), Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
[System.Xml.Serialization.XmlElementAttribute("report_metadata", typeof(feedbackReport_metadata), Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public object[] Items
{
get
{
return this.itemsField;
}
set
{
this.itemsField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
public partial class feedbackPolicy_published
{
private string domainField;
private string adkimField;
private string aspfField;
private string pField;
private string pctField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string domain
{
get
{
return this.domainField;
}
set
{
this.domainField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string adkim
{
get
{
return this.adkimField;
}
set
{
this.adkimField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string aspf
{
get
{
return this.aspfField;
}
set
{
this.aspfField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string p
{
get
{
return this.pField;
}
set
{
this.pField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string pct
{
get
{
return this.pctField;
}
set
{
this.pctField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
public partial class feedbackRecord
{
private feedbackRecordRow[] rowField;
private feedbackRecordIdentifiers[] identifiersField;
private feedbackRecordAuth_results[] auth_resultsField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("row", Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public feedbackRecordRow[] row
{
get
{
return this.rowField;
}
set
{
this.rowField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("identifiers", Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public feedbackRecordIdentifiers[] identifiers
{
get
{
return this.identifiersField;
}
set
{
this.identifiersField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("auth_results", Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public feedbackRecordAuth_results[] auth_results
{
get
{
return this.auth_resultsField;
}
set
{
this.auth_resultsField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
public partial class feedbackRecordRow
{
private string source_ipField;
private string countField;
private feedbackRecordRowPolicy_evaluated[] policy_evaluatedField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string source_ip
{
get
{
return this.source_ipField;
}
set
{
this.source_ipField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string count
{
get
{
return this.countField;
}
set
{
this.countField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("policy_evaluated", Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public feedbackRecordRowPolicy_evaluated[] policy_evaluated
{
get
{
return this.policy_evaluatedField;
}
set
{
this.policy_evaluatedField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
public partial class feedbackRecordRowPolicy_evaluated
{
private string dispositionField;
private string dkimField;
private string spfField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string disposition
{
get
{
return this.dispositionField;
}
set
{
this.dispositionField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string dkim
{
get
{
return this.dkimField;
}
set
{
this.dkimField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string spf
{
get
{
return this.spfField;
}
set
{
this.spfField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
public partial class feedbackRecordIdentifiers
{
private string header_fromField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string header_from
{
get
{
return this.header_fromField;
}
set
{
this.header_fromField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
public partial class feedbackRecordAuth_results
{
private feedbackRecordAuth_resultsDkim[] dkimField;
private feedbackRecordAuth_resultsSpf[] spfField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("dkim", Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public feedbackRecordAuth_resultsDkim[] dkim
{
get
{
return this.dkimField;
}
set
{
this.dkimField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("spf", Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public feedbackRecordAuth_resultsSpf[] spf
{
get
{
return this.spfField;
}
set
{
this.spfField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
public partial class feedbackRecordAuth_resultsDkim
{
private string domainField;
private string resultField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string domain
{
get
{
return this.domainField;
}
set
{
this.domainField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string result
{
get
{
return this.resultField;
}
set
{
this.resultField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
public partial class feedbackRecordAuth_resultsSpf
{
private string domainField;
private string resultField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string domain
{
get
{
return this.domainField;
}
set
{
this.domainField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string result
{
get
{
return this.resultField;
}
set
{
this.resultField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
public partial class feedbackReport_metadata
{
private string org_nameField;
private string emailField;
private string report_idField;
private feedbackReport_metadataDate_range[] date_rangeField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string org_name
{
get
{
return this.org_nameField;
}
set
{
this.org_nameField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string email
{
get
{
return this.emailField;
}
set
{
this.emailField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string report_id
{
get
{
return this.report_idField;
}
set
{
this.report_idField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("date_range", Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public feedbackReport_metadataDate_range[] date_range
{
get
{
return this.date_rangeField;
}
set
{
this.date_rangeField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
public partial class feedbackReport_metadataDate_range
{
private string beginField;
private string endField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string begin
{
get
{
return this.beginField;
}
set
{
this.beginField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string end
{
get
{
return this.endField;
}
set
{
this.endField = value;
}
}
}