Quantcast
Channel: xsd2Code community edition .net class generator from XSD schema
Viewing all articles
Browse latest Browse all 543

Commented Issue: The /eit flag does not work with xsd:include [15099]

$
0
0
The problem is the following:
* All schemas that are included have to have the same target namespace as the including schema (this is a requirement in XSD)
* Your ContainsTypeName method (in Xsd2Code.Library.Extensions.CodeExtension.cs) checks for namespace equality
 
Therefore ALL types in the XSD files (directly or through includes) are classified as directly in the same file by your logic. This should be fixed.
Comments: ** Comment from web user: jparson **

I realized after posting that I didn't really explain why I chose the solution I did.

The current process removes all types that are not in the original XSD. The problem with this is that the code generation will sometimes create classes that aren't in the original XSD or any included XSDs. These types are created when there is a complex element declared in line in the XSD.

Example XSD element:
```
<element name="parent">
<complexType>
<element name="element1" type="String" />
<element name="elementNoType">
<complexType>
<element name="element2" type="String" />
</complexType>
</element>
</complexType>
</element>
```

The XSD element above will produce the following classes:
```
class Main
{
typeMain parent;
}

class typeMain
{
string element1;
typeMainElementNoType elementNoType;
}

class typeMainElementNoType
{
string element2;
}
```

typeMain and typeMainElementNoType are required in the final generated code. However, the current process will remove them.

I know that this can be corrected by moving the complexType declarations into named complexTypes, but this isn't always possible. Especially when you don't own the XSD and must simply use it as is.

Hopefully, this explains the need for the change to the program a little better.


Viewing all articles
Browse latest Browse all 543

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>