Wednesday 15 July 2015

xml - Generate C# class from XSD sitemap with images -



xml - Generate C# class from XSD sitemap with images -

could help me generate c# class xsd(sitemap with images)?

<?xml version="1.0" encoding="utf-8"?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"> <url> <loc>http://example.com/sample.html</loc> <image:image> <image:loc>http://example.com/image.jpg</image:loc> </image:image> <image:image> <image:loc>http://example.com/photo.jpg</image:loc> </image:image> </url> </urlset>

here classes generated xsd.exe tool:

[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[] { { homecoming this.anyfield; } set { this.anyfield = value; } } /// <remarks/> [system.xml.serialization.xmlelementattribute("url")] public list<turl> url { { homecoming 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 { { homecoming this.locfield; } set { this.locfield = value; } } /// <remarks/> public string lastmod { { homecoming this.lastmodfield; } set { this.lastmodfield = value; } } /// <remarks/> public tchangefreq changefreq { { homecoming this.changefreqfield; } set { this.changefreqfield = value; } } /// <remarks/> [system.xml.serialization.xmlignoreattribute()] public bool changefreqspecified { { homecoming this.changefreqfieldspecified; } set { this.changefreqfieldspecified = value; } } /// <remarks/> public decimal priority { { homecoming this.priorityfield; } set { this.priorityfield = value; } } /// <remarks/> [system.xml.serialization.xmlignoreattribute()] public bool priorityspecified { { homecoming this.priorityfieldspecified; } set { this.priorityfieldspecified = value; } } /// <remarks/> [system.xml.serialization.xmlanyelementattribute()] public system.xml.xmlelement[] { { homecoming 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 { { homecoming this.locfield; } set { this.locfield = value; } } /// <remarks/> public string caption { { homecoming this.captionfield; } set { this.captionfield = value; } } /// <remarks/> public string geo_location { { homecoming this.geo_locationfield; } set { this.geo_locationfield = value; } } /// <remarks/> public string title { { homecoming this.titlefield; } set { this.titlefield = value; } } /// <remarks/> [system.xml.serialization.xmlelementattribute(datatype = "anyuri")] public string license { { homecoming this.licensefield; } set { this.licensefield = value; } } }

but have problem prefix 'image:', not sort out how add together prefix serialized xml. if modify element name adding semicolon, do escape 'image_x003a_image'

c# xml image sitemap

No comments:

Post a Comment