https://github.com/stefh/xsdclassgentest
XsdClassGen Test project
https://github.com/stefh/xsdclassgentest
class deserializer generation generator serializer xml xsd xsd-files xsdclassgen
Last synced: 3 months ago
JSON representation
XsdClassGen Test project
- Host: GitHub
- URL: https://github.com/stefh/xsdclassgentest
- Owner: StefH
- License: mit
- Created: 2018-11-21T14:44:57.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-11-21T15:11:28.000Z (over 6 years ago)
- Last Synced: 2024-04-14T13:08:23.368Z (about 1 year ago)
- Topics: class, deserializer, generation, generator, serializer, xml, xsd, xsd-files, xsdclassgen
- Language: C#
- Size: 18.6 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# XsdClassGenTest
XsdClassGen Test project based on https://gitlab.com/pommalabs/xsdclassgen (which is based on https://www.nuget.org/packages/XsdClassGen)##### Modifications:
- remove generation from the serialization classes and implemented a simple generic `XmlConverter` class.### Example
#### XSD
``` xml
```
#### Generated c# Code
``` c#
namespace MySpecialDomainNamespace {
///
/// Automatically generated XML type mapping for PurchaseOrder.
///
///
/// This is an automaticaly generated type, please do not edit it.
///
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.7.3056.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://tempuri.org/PurchaseOrderSchema.xsd")]
[System.Xml.Serialization.XmlRootAttribute(Namespace="http://tempuri.org/PurchaseOrderSchema.xsd", IsNullable=true)]
public partial class PurchaseOrder {
private USAddress[] shipToField;
private USAddress billToField;
private System.DateTime orderDateField;
private bool orderDateFieldSpecified;
///
/// Gets or sets ShipTo.
///
[System.Xml.Serialization.XmlElementAttribute("ShipTo")]
public USAddress[] ShipTo {
get {
return this.shipToField;
}
set {
this.shipToField = value;
}
}// More ...
```### Usage
This code:
``` c#
var p = new PurchaseOrder
{
BillTo = new USAddress
{
country = "NL",
name = "test",
zip = 55656
}
};string s = XmlConverter.SerializeObject(p);
Console.WriteLine(s);
```Generates this XML:
``` xml
test
55656
```