You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have several schemas that use shared types defined in another schema. I can generate these with a single run of xsd.exe, but it doesn't provide some of the features I need.
When I try the same thing with XmlSchemaClassGenerator, I get a variety of exceptions. At first I thought it was a problem with two xsd files importing the same shared file, but then I tried it with just one of the main files. The exception I get depends on which file I specify first:
>XmlSchemaClassGenerator.Console.exe shared.xsd main1.xsd
Unhandled Exception: System.Exception: Namespace main1 not provided through map or generator.
at XmlSchemaClassGenerator.Generator.BuildNamespace(Uri source, String xmlNamespace)
at XmlSchemaClassGenerator.Generator.CreateNamespaceModel(Uri source, XmlQualifiedName qualifiedName)
at XmlSchemaClassGenerator.Generator.CreateTypeModel(Uri source, XmlSchemaAnnotated type, XmlQualifiedName qualifiedName)
at XmlSchemaClassGenerator.Generator.BuildModel()
at XmlSchemaClassGenerator.Generator.Generate(IEnumerable`1 files)
at XmlSchemaClassGenerator.Console.Program.Main(String[] args)
>XmlSchemaClassGenerator.Console.exe main1.xsd shared.xsd
Unhandled Exception: System.Xml.Schema.XmlSchemaException: The complexType 'Shared:sharedType' has already been declared.
at System.Xml.Schema.XmlSchemaSet.InternalValidationCallback(Object sender, ValidationEventArgs e)
at System.Xml.Schema.BaseProcessor.AddToTable(XmlSchemaObjectTable table, XmlQualifiedName qname, XmlSchemaObject item)
at System.Xml.Schema.Compiler.Prepare(XmlSchema schema, Boolean cleanup)
at System.Xml.Schema.XmlSchemaSet.Compile()
at XmlSchemaClassGenerator.Generator.Generate(IEnumerable`1 files)
at XmlSchemaClassGenerator.Console.Program.Main(String[] args)
The fact that you have to explicitly specify the namespace identifiers is due to a shortcoming in the code that autogenerates namespace identifiers AFAICT. I'll fix this shortly.
I have several schemas that use shared types defined in another schema. I can generate these with a single run of xsd.exe, but it doesn't provide some of the features I need.
When I try the same thing with XmlSchemaClassGenerator, I get a variety of exceptions. At first I thought it was a problem with two xsd files importing the same shared file, but then I tried it with just one of the main files. The exception I get depends on which file I specify first:
shared.xsd
main1.xsd
main2.xsd
The text was updated successfully, but these errors were encountered: