You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+35-1Lines changed: 35 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -210,6 +210,11 @@ Options:
210
210
force URI scheme when resolving URLs (default is
211
211
none; can be: none, same, or any defined value
212
212
for scheme, like https or http)
213
+
--ema, --emitMetadataAttributes
214
+
emit metadata helper attributes (default is false)
215
+
--mn, --metadataNamespace=VALUE
216
+
namespace for generated metadata helper attributes (
217
+
default is XmlSchemaClassGenerator.Metadata)
213
218
</pre>
214
219
215
220
For use from code use the [library NuGet package](https://www.nuget.org/packages/XmlSchemaClassGenerator-beta/):
@@ -236,12 +241,41 @@ Specifying the `NamespaceProvider` is optional. If you don't provide one, C# nam
236
241
vargenerator=newGenerator
237
242
{
238
243
NamespaceProvider=newNamespaceProvider
239
-
{
244
+
{
240
245
GenerateNamespace=key=>...
241
246
}
242
247
};
243
248
```
244
249
250
+
### Metadata attributes
251
+
252
+
When `EmitMetadataAttributes` is enabled, the generator emits custom attributes for XML schema restrictions that aren't covered by standard DataAnnotations. For example, `xs:fractionDigits` becomes `FractionDigitsAttribute`:
The attribute definition is automatically generated in the specified namespace. If not specified, the default namespace is `XmlSchemaClassGenerator.Metadata`.
278
+
245
279
### Mapping xsd files to C# namespaces
246
280
247
281
Using the optional `|` syntax of the `-n` command line option you can map individual xsd files to C# namespaces. If you have several input files using the same XML namespace you can still generate an individual C# namespace for the types defined within a single xsd file. For example, if you have two input files `a.xsd` and `b.xsd` both of which have the same `targetNamespace` of `http://example.com/namespace` you can generate the C# namespaces `Example.NamespaceA` and `Example.NamespaceB`:
@@ -171,7 +173,7 @@ A file name may be given by appending a pipe sign (|) followed by a file name (l
171
173
{"uc|unionCommonType","generate a common type for unions if possible (default is false)", v =>unionCommonType=v!=null},
172
174
{"ec|serializeEmptyCollections","serialize empty collections (default is false)", v =>serializeEmptyCollections=v!=null},
173
175
{"dtd|allowDtdParse","allows dtd parse (default is false)", v =>allowDtdParse=v!=null},
174
-
{"oxi|omitXmlIncludeAttribute","omit generation of XmlIncludeAttribute for derived types (default is false)", v =>omitXmlIncludeAttribute=v!=null},
176
+
{"oxi|omitXmlIncludeAttribute","omit generation of XmlIncludeAttribute for derived types (default is false)", v =>omitXmlIncludeAttribute=v!=null},
175
177
{"ecl|enumCollection","generate typed enum collections for xs:list types instead of string collections (default is false)", v =>enumCollection=v!=null},
176
178
{"ns|namingScheme=",@"use the specified naming scheme for class and property names (default is Pascal; can be: Direct, Pascal, Legacy)",
177
179
v =>
@@ -185,7 +187,9 @@ A file name may be given by appending a pipe sign (|) followed by a file name (l
185
187
};
186
188
}
187
189
},
188
-
{"fu|forceUriScheme=","force URI scheme when resolving URLs (default is none; can be: none, same, or any defined value for scheme, like https or http)", v =>forceUriScheme=v}
190
+
{"fu|forceUriScheme=","force URI scheme when resolving URLs (default is none; can be: none, same, or any defined value for scheme, like https or http)", v =>forceUriScheme=v},
191
+
{"ema|emitMetadataAttributes","emit metadata helper attributes (default is false)", v =>emitMetadataAttributes=v!=null},
192
+
{"mn|metadataNamespace=",$"namespace for generated metadata helper attributes (default is {GeneratorConfiguration.DefaultMetadataNamespace})", v =>metadataNamespace=v}
189
193
};
190
194
191
195
varglobsAndUris=options.Parse(args);
@@ -274,9 +278,11 @@ A file name may be given by appending a pipe sign (|) followed by a file name (l
0 commit comments