Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid Chars #221

Open
Tobias-08 opened this issue Aug 10, 2020 · 6 comments
Open

Invalid Chars #221

Tobias-08 opened this issue Aug 10, 2020 · 6 comments

Comments

@Tobias-08
Copy link

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).

@mganss
Copy link
Owner

mganss commented Aug 10, 2020

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?).

@TjerkDrouen
Copy link

TjerkDrouen commented Aug 23, 2023

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.

@mganss
Copy link
Owner

mganss commented Sep 5, 2023

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).

@luissagasta
Copy link

This feature would be very useful when you have a lost of XSD files and a lot of classes are generated.
In my case using the type name substitution feature has no sense because more than 1000 classes are generated.
I would like that when a period "." is in the name it be removed (replaced by empty string) instead of being replaced by "Period" but I can't find an easy workaround.

@mganss
Copy link
Owner

mganss commented Nov 6, 2024

@luissagasta This is the case with the new PascalCase naming scheme. Are you using the direct or legacy naming schemes?

@luissagasta
Copy link

I am using direct naming schema

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants