XmlSchemaClassGenerator icon indicating copy to clipboard operation
XmlSchemaClassGenerator copied to clipboard

How can I set different output file name and namespace for the generated code?

Open inyutin-maxim opened this issue 9 months ago • 3 comments

How it works now:

xscgen ./myXsd.xsd -n MyNameSpace -t --output=./

Creates a file named MyNamespace and contain MyNamespace namespace

How it can be work:

xscgen ./myXsd.xsd -n MyNameSpace -t --output=./ --filename=myFileName

Creates a file named myFileName and contain MyNamespace namespace

inyutin-maxim avatar Mar 25 '25 19:03 inyutin-maxim

I'm hesitant to consider this as it would mean you would have to be able to provide a mapping from C# namespace names to file names. It's complicated enough already with the mappings from XML namespaces to C# namespaces.

If you want to customize further, you can always use the library and create your custom OutputWriter implementation.

mganss avatar Mar 25 '25 21:03 mganss

Thank you for your response . I understand that I can override many things in the code, I just wanted to clarify if there is no way to get a specific name for the output file, and a different value for the namespace of that file out of the box.

If this would be useful functionality for the project, I could try to expand the functionality and send a PR

inyutin-maxim avatar Mar 26 '25 13:03 inyutin-maxim

Keep in mind that if there's more than one C# namespace there would have to be a way to configure the mapping between C# namespaces and files. I doubt that this feature will be useful for many users.

Thank you very much for offering to contribute, though. I think your effort would be better spent in fixing other open issues labeled "help wanted".

mganss avatar Mar 26 '25 20:03 mganss