An open API service indexing awesome lists of open source software.

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

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

```