XmlSchemaClassGenerator icon indicating copy to clipboard operation
XmlSchemaClassGenerator copied to clipboard

Invalid Chars

Open Tobias-08 opened this issue 5 years ago • 6 comments

Hi,

great library!

One suggestion for another feature: It would be great to be able to override the default replacements for invalid chars in the cli (https://github.com/mganss/XmlSchemaClassGenerator/blob/46da19544ce19a466d97ac5140da62865ef3f6e7/XmlSchemaClassGenerator/NamingExtensions.cs).

Tobias-08 avatar Aug 10 '20 07:08 Tobias-08

This is similar to #220. Ideally, you'd be able to provide custom replacements for individual characters and whole strings, so that e.g. you'd be able to replace the string "-" with "Dash" only for the special case where the identifier is exactly "-" and with _ for the general case (such as separated-id to separated_id).

Perhaps in addition to specifying individual replace directly in the CLI it would be nice to be able to specify a mapping file (JSON or TOML?).

mganss avatar Aug 10 '20 10:08 mganss

It would be great if the naming would be more suitable for periods (.) and hyphens (-) inside XSD complexType names.

Currently <xs:complexType name="QUMT_MT020099NL02.EffectiveTimeInterval"> results in public partial class QUMT_MT020099NL02PeriodEffectiveTimeInterval

Expect type names with periods and hyphens. https://www.w3schools.com/xml/xml_elements.asp Element names can contain letters, digits, hyphens, underscores, and periods

Please substitute the C# class naming with underscores for periods and hyphens.

TjerkDrouen avatar Aug 23 '23 14:08 TjerkDrouen

Perhaps for now you can use the type name substitution feature (--tns and --tnsf) or the PascalCase feature (-a) which just got improved (see #413).

mganss avatar Sep 05 '23 14:09 mganss