XmlSchemaClassGenerator icon indicating copy to clipboard operation
XmlSchemaClassGenerator copied to clipboard

Disable prefixing of type name with parent type name

Open masaeedu opened this issue 8 years ago • 1 comments

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.

masaeedu avatar Aug 31 '17 23:08 masaeedu

No, currently this is not possible ☹️ PRs are always welcome, though 😉 Here's the relevant source.

mganss avatar Sep 01 '17 14:09 mganss