XmlSchemaClassGenerator
XmlSchemaClassGenerator copied to clipboard
Disable prefixing of type name with parent type name
For a schema that looks like the following:
<?xml version="1.0" encoding="utf-16"?>
<xsd:schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsd="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified">
<xs:element name="MachineList">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="Machine">
<xs:complexType>
<xs:sequence>
<xs:choice maxOccurs="unbounded">
...
</xs:choice>
</xs:sequence>
<xs:attribute name="Name" type="xs:string" use="required" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xsd:schema>
The generated code contains a class corresponding to our <xs:element maxOccurs="unbounded" name="Machine"> element with the name: public partial class MachineListMachine.
Is it possible to disable this prefixing of the type name with the parent type's name (or otherwise customize it)? I'd like the class to instead simply be named public partial class Machine.
No, currently this is not possible ☹️ PRs are always welcome, though 😉 Here's the relevant source.