Xsd2code multiple xsd files duplicate subclasses

I use xsd2code to generate classes from the xsd schema provided by the star standard.

I tried using xsd.exe to generate classes, but that didn't help.

When I generate a class from "ProcessCreditApplication.xsd", it generates a single file with all the necessary classes. At this point, everything is working fine.

When I create another xsd, ConfirmBOD.xsd, I get ambiguity errors because both files contain the same base classes.

For example, both files generate the class 'Description'. Since both files are in the same namespace, there is ambiguity between two classes in the same namespace.

Is there a way to generate classes from multiple xsd so that the subclass is not duplicated?

My only thought to solve this problem is only each generated file in its own namespace. It is not perfect, but it works.

I would like to use xsd.exe as it seems to take multiplicative files, but the code that it generates does not work for my needs.

Update I tried Linq for xsd and it did not work. He complained that the same types were "already declared."

For reference: here I get the circuit:

http://www.starstandard.org/SIGXMLSTAR4/XMLSchemas http://www.starstandard.org/uploads/SIGXMLSTAR4/STARSchemaRepository_Rev444.zip

+3
source share
4 answers

xsd.exe. Microsoft LinqToXsd # XSD. XSD , .

LinqToXsd CodePlex

:

LinqToXsd <schemaFile> [one or more schema files] [/fileName:<csFileName>.cs] [/lib:<assemblyName>] [/config:<configFileName>.xml] [/enableServiceReference] [/nameMangler2]
+1

, :

  • .
  • (, ).

, , , .

+1

XML LinqToXsd.

mogness, http://blog.mogness.com/?p=36

<?xml version="1.0" encoding="utf-8" ?>
<Configuration xmlns="http://www.microsoft.com/xml/schema/linq">
  <Namespaces>
    <Namespace Schema="http://www.Schema1" Clr="My.Schema1"/>
    <Namespace Schema="http://www.Schema2" Clr="My.Schema2"/>
    <Namespace Schema="" Clr="My"/>
  </Namespaces>
</Configuration>

Visual Studio, ehosca, http://linqtoxsd.codeplex.com/discussions/238570#PostDetailsCell_591728

XML , XSD, ( linq2xsdconfig.xml)

linq2xsdconfig.xml : LinqToXsdConfiguration

XML LinqToXsd.exe, @bporter.

LinqToXsd <schemaFile> /config:linq2xsdconfig.xml
+1

" ", .

+1

Source: https://habr.com/ru/post/1764235/


All Articles