I have the below XSD & when I am trying to generate XML out of it I am getting the above error : Error!!! The type attribute cannot be present with either simple
If you define the type of your element inline you can't name it so remove the type="InvoiceData" attribute (and then the name="InvoiceData" attribute as well).
If you want to use those attributes then you need to separate element and type definition e.g. and .
The complete schema would be either
or