从带有图像的XSD站点地图生成C#类

从带有图像的XSD站点地图生成C#类,c#,xml,image,sitemap,C#,Xml,Image,Sitemap,有人能帮我从XSD生成C#类(带有图像的sitemap)吗 http://example.com/sample.html http://example.com/image.jpg http://example.com/photo.jpg 这是我的类,它们是由xsd.exe工具生成的: [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.3038")] [System.SerializableAttrib

有人能帮我从XSD生成C#类(带有图像的sitemap)吗


http://example.com/sample.html
http://example.com/image.jpg
http://example.com/photo.jpg
这是我的类,它们是由xsd.exe工具生成的:

 [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.3038")]
    [System.SerializableAttribute()]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    [System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true,
        Namespace = "http://www.sitemaps.org/schemas/sitemap/0.9")]
    [System.Xml.Serialization.XmlRootAttribute(Namespace = "http://www.sitemaps.org/schemas/sitemap/0.9",
        IsNullable = false)]
    public partial class urlset
    {

        private System.Xml.XmlElement[] anyField;

        private List<tUrl> urlField;

        /// <remarks/>
        [System.Xml.Serialization.XmlAnyElementAttribute()]
        public System.Xml.XmlElement[] Any
        {
            get { return this.anyField; }
            set { this.anyField = value; }
        }

        /// <remarks/>
        [System.Xml.Serialization.XmlElementAttribute("url")]
        public List<tUrl> url
        {
            get { return this.urlField; }
            set { this.urlField = value; }
        }
    }

    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.3038")]
    [System.SerializableAttribute()]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    [System.Xml.Serialization.XmlTypeAttribute(Namespace = "http://www.sitemaps.org/schemas/sitemap/0.9")]
    public partial class tUrl
    {

        private string locField;

        private string lastmodField;

        private tChangeFreq changefreqField;

        private bool changefreqFieldSpecified;

        private decimal priorityField;

        private bool priorityFieldSpecified;

        private System.Xml.XmlElement[] anyField;

        /// <remarks/>
        [System.Xml.Serialization.XmlElementAttribute(DataType = "anyURI")]
        public string loc
        {
            get { return this.locField; }
            set { this.locField = value; }
        }

        /// <remarks/>
        public string lastmod
        {
            get { return this.lastmodField; }
            set { this.lastmodField = value; }
        }

        /// <remarks/>
        public tChangeFreq changefreq
        {
            get { return this.changefreqField; }
            set { this.changefreqField = value; }
        }

        /// <remarks/>
        [System.Xml.Serialization.XmlIgnoreAttribute()]
        public bool changefreqSpecified
        {
            get { return this.changefreqFieldSpecified; }
            set { this.changefreqFieldSpecified = value; }
        }

        /// <remarks/>
        public decimal priority
        {
            get { return this.priorityField; }
            set { this.priorityField = value; }
        }

        /// <remarks/>
        [System.Xml.Serialization.XmlIgnoreAttribute()]
        public bool prioritySpecified
        {
            get { return this.priorityFieldSpecified; }
            set { this.priorityFieldSpecified = value; }
        }

        /// <remarks/>
        [System.Xml.Serialization.XmlAnyElementAttribute()]
        public System.Xml.XmlElement[] Any
        {
            get { return this.anyField; }
            set { this.anyField = value; }
        }

        [System.Xml.Serialization.XmlElementAttribute(ElementName = "image", Type = typeof(image))]
        public List<image> Images { get; set; }

    }

    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.3038")]
    [System.SerializableAttribute()]
    [System.Xml.Serialization.XmlTypeAttribute(Namespace = "http://www.sitemaps.org/schemas/sitemap/0.9")]
    public enum tChangeFreq
    {

        /// <remarks/>
        always,

        /// <remarks/>
        hourly,

        /// <remarks/>
        daily,

        /// <remarks/>
        weekly,

        /// <remarks/>
        monthly,

        /// <remarks/>
        yearly,

        /// <remarks/>
        never,
    }

    [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.3038")]
    [System.SerializableAttribute()]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    [System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true,
        Namespace = "http://www.google.com/schemas/sitemap-image/1.1")]
    [System.Xml.Serialization.XmlRootAttribute(Namespace = "http://www.google.com/schemas/sitemap-image/1.1",
        IsNullable = false)]
    public partial class image
    {

        private string locField;

        private string captionField;

        private string geo_locationField;

        private string titleField;

        private string licenseField;

        /// <remarks/>
        [System.Xml.Serialization.XmlElementAttribute(ElementName = "loc", DataType = "anyURI")]
        public string loc
        {
            get { return this.locField; }
            set { this.locField = value; }
        }

        /// <remarks/>
        public string caption
        {
            get { return this.captionField; }
            set { this.captionField = value; }
        }

        /// <remarks/>
        public string geo_location
        {
            get { return this.geo_locationField; }
            set { this.geo_locationField = value; }
        }

        /// <remarks/>
        public string title
        {
            get { return this.titleField; }
            set { this.titleField = value; }
        }

        /// <remarks/>
        [System.Xml.Serialization.XmlElementAttribute(DataType = "anyURI")]
        public string license
        {
            get { return this.licenseField; }
            set { this.licenseField = value; }
        }
    }
[System.CodeDom.Compiler.GeneratedCodeAttribute(“xsd”、“2.0.50727.3038”)]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute(“代码”)]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true,
名称空间=”http://www.sitemaps.org/schemas/sitemap/0.9")]
[System.Xml.Serialization.XmlRootAttribute(命名空间=”http://www.sitemaps.org/schemas/sitemap/0.9",
IsNullable=false)]
公共部分类urlset
{
private System.Xml.xmlement[]anyField;
私有列表字段;
/// 
[System.Xml.Serialization.XmlAnyElementAttribute()]
public System.Xml.xmlement[]任何
{
获取{返回this.anyField;}
设置{this.anyField=value;}
}
/// 
[System.Xml.Serialization.xmlementAttribute(“url”)]
公共列表url
{
获取{返回this.urlField;}
设置{this.urlField=value;}
}
}
/// 
[System.CodeDom.Compiler.GeneratedCodeAttribute(“xsd”、“2.0.50727.3038”)]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute(“代码”)]
[System.Xml.Serialization.XmlTypeAttribute(命名空间=”http://www.sitemaps.org/schemas/sitemap/0.9")]
公共部分类tUrl
{
私有字符串字段;
私有字符串字段;
专用tChangeFreq changefreqField;
指定的专用布尔值;
私有十进制优先字段;
指定的专用布尔优先字段;
private System.Xml.xmlement[]anyField;
/// 
[System.Xml.Serialization.xmlementAttribute(DataType=“anyURI”)]
公共字符串loc
{
获取{返回this.locField;}
设置{this.locField=value;}
}
/// 
公共字符串lastmod
{
获取{返回this.lastmodField;}
设置{this.lastmodField=value;}
}
/// 
公共tChangeFreq changefreq
{
获取{返回this.changefreqField;}
设置{this.changefreqField=value;}
}
/// 
[System.Xml.Serialization.XmlIgnoreAttribute()]
指定公共布尔值
{
获取{返回this.changefreqFieldSpecified;}
设置{this.changefreqFieldSpecified=value;}
}
/// 
公共十进制优先级
{
获取{返回this.priorityField;}
设置{this.priorityField=value;}
}
/// 
[System.Xml.Serialization.XmlIgnoreAttribute()]
指定公共布尔优先权
{
获取{返回this.priorityFieldSpecified;}
设置{this.priorityFieldSpecified=value;}
}
/// 
[System.Xml.Serialization.XmlAnyElementAttribute()]
public System.Xml.xmlement[]任何
{
获取{返回this.anyField;}
设置{this.anyField=value;}
}
[System.Xml.Serialization.xmlementAttribute(ElementName=“image”,Type=typeof(image))]
公共列表图像{get;set;}
}
/// 
[System.CodeDom.Compiler.GeneratedCodeAttribute(“xsd”、“2.0.50727.3038”)]
[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute(命名空间=”http://www.sitemaps.org/schemas/sitemap/0.9")]
公共枚举tChangeFreq
{
/// 
总是,
/// 
每小时,
/// 
每日的
/// 
每周,
/// 
月刊
/// 
每年,
/// 
从未,
}
[System.CodeDom.Compiler.GeneratedCodeAttribute(“xsd”、“2.0.50727.3038”)]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute(“代码”)]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true,
名称空间=”http://www.google.com/schemas/sitemap-image/1.1")]
[System.Xml.Serialization.XmlRootAttribute(命名空间=”http://www.google.com/schemas/sitemap-image/1.1",
IsNullable=false)]
公共部分类映像
{
私有字符串字段;
私有字符串标题字段;
私有字符串地理位置字段;
私有字符串标题字段;
私有字符串许可证字段;
/// 
[System.Xml.Serialization.xmlementAttribute(ElementName=“loc”,DataType=“anyURI”)]
公共字符串loc
{
获取{返回this.locField;}
设置{this.locField=value;}
}
/// 
公共字符串标题
{
获取{返回this.captionField;}
设置{this.captionField=value;}
}
/// 
公共字符串地理位置
{
获取{返回this.geo_locationField;}
设置{this.geo_locationField=value;}
}
/// 
公共字符串标题
{
获取{返回this.titleField;}
设置{this.titleField=value;}
}
/// 
[System.Xml.Serialization.xmlementAttribute(DataType=“anyURI”)]
公共字符串许可证
{
获取{返回this.licenseField;}
设置{this.licenseField=value;}
}
}
但是我对前缀“image:”有问题,,我无法确定如何将此前缀添加到序列化的xml中。如果我通过添加分色来修改元素名
 [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.3038")]
    [System.SerializableAttribute()]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    [System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true,
        Namespace = "http://www.sitemaps.org/schemas/sitemap/0.9")]
    [System.Xml.Serialization.XmlRootAttribute(Namespace = "http://www.sitemaps.org/schemas/sitemap/0.9",
        IsNullable = false)]
    public partial class urlset
    {

        private System.Xml.XmlElement[] anyField;

        private List<tUrl> urlField;

        /// <remarks/>
        [System.Xml.Serialization.XmlAnyElementAttribute()]
        public System.Xml.XmlElement[] Any
        {
            get { return this.anyField; }
            set { this.anyField = value; }
        }

        /// <remarks/>
        [System.Xml.Serialization.XmlElementAttribute("url")]
        public List<tUrl> url
        {
            get { return this.urlField; }
            set { this.urlField = value; }
        }
    }

    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.3038")]
    [System.SerializableAttribute()]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    [System.Xml.Serialization.XmlTypeAttribute(Namespace = "http://www.sitemaps.org/schemas/sitemap/0.9")]
    public partial class tUrl
    {

        private string locField;

        private string lastmodField;

        private tChangeFreq changefreqField;

        private bool changefreqFieldSpecified;

        private decimal priorityField;

        private bool priorityFieldSpecified;

        private System.Xml.XmlElement[] anyField;

        /// <remarks/>
        [System.Xml.Serialization.XmlElementAttribute(DataType = "anyURI")]
        public string loc
        {
            get { return this.locField; }
            set { this.locField = value; }
        }

        /// <remarks/>
        public string lastmod
        {
            get { return this.lastmodField; }
            set { this.lastmodField = value; }
        }

        /// <remarks/>
        public tChangeFreq changefreq
        {
            get { return this.changefreqField; }
            set { this.changefreqField = value; }
        }

        /// <remarks/>
        [System.Xml.Serialization.XmlIgnoreAttribute()]
        public bool changefreqSpecified
        {
            get { return this.changefreqFieldSpecified; }
            set { this.changefreqFieldSpecified = value; }
        }

        /// <remarks/>
        public decimal priority
        {
            get { return this.priorityField; }
            set { this.priorityField = value; }
        }

        /// <remarks/>
        [System.Xml.Serialization.XmlIgnoreAttribute()]
        public bool prioritySpecified
        {
            get { return this.priorityFieldSpecified; }
            set { this.priorityFieldSpecified = value; }
        }

        /// <remarks/>
        [System.Xml.Serialization.XmlAnyElementAttribute()]
        public System.Xml.XmlElement[] Any
        {
            get { return this.anyField; }
            set { this.anyField = value; }
        }

        [System.Xml.Serialization.XmlElementAttribute(ElementName = "image", Type = typeof(image))]
        public List<image> Images { get; set; }

    }

    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.3038")]
    [System.SerializableAttribute()]
    [System.Xml.Serialization.XmlTypeAttribute(Namespace = "http://www.sitemaps.org/schemas/sitemap/0.9")]
    public enum tChangeFreq
    {

        /// <remarks/>
        always,

        /// <remarks/>
        hourly,

        /// <remarks/>
        daily,

        /// <remarks/>
        weekly,

        /// <remarks/>
        monthly,

        /// <remarks/>
        yearly,

        /// <remarks/>
        never,
    }

    [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.3038")]
    [System.SerializableAttribute()]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    [System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true,
        Namespace = "http://www.google.com/schemas/sitemap-image/1.1")]
    [System.Xml.Serialization.XmlRootAttribute(Namespace = "http://www.google.com/schemas/sitemap-image/1.1",
        IsNullable = false)]
    public partial class image
    {

        private string locField;

        private string captionField;

        private string geo_locationField;

        private string titleField;

        private string licenseField;

        /// <remarks/>
        [System.Xml.Serialization.XmlElementAttribute(ElementName = "loc", DataType = "anyURI")]
        public string loc
        {
            get { return this.locField; }
            set { this.locField = value; }
        }

        /// <remarks/>
        public string caption
        {
            get { return this.captionField; }
            set { this.captionField = value; }
        }

        /// <remarks/>
        public string geo_location
        {
            get { return this.geo_locationField; }
            set { this.geo_locationField = value; }
        }

        /// <remarks/>
        public string title
        {
            get { return this.titleField; }
            set { this.titleField = value; }
        }

        /// <remarks/>
        [System.Xml.Serialization.XmlElementAttribute(DataType = "anyURI")]
        public string license
        {
            get { return this.licenseField; }
            set { this.licenseField = value; }
        }
    }
    [XmlNamespaceDeclarations]
    public XmlSerializerNamespaces xmlns = new XmlSerializerNamespaces();


  public urlset()
    {
        xmlns.Add("image", "http://www.google.com/schemas/sitemap-image/1.1");
    }
        [XmlElement(Namespace = "http://www.google.com/schemas/sitemap-image/1.1")]
    public image image
    {
        get
        {
            return this.imageField;
        }
        set
        {
            this.imageField = value;
        }
    }