Skip to content

Commit

Permalink
Use type's source URI
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Ganss committed May 26, 2021
1 parent 0a0568e commit 7ba7203
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions XmlSchemaClassGenerator/ModelBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -247,11 +247,10 @@ private void CreateElements(IEnumerable<XmlSchemaElement> elements)
{
foreach (var rootElement in elements)
{
var rootSchema = rootElement.GetSchema();
var source = CodeUtilities.CreateUri(rootSchema.SourceUri);
var typeSource = CodeUtilities.CreateUri(rootElement.ElementSchemaType.SourceUri);
var qualifiedName = rootElement.ElementSchemaType.QualifiedName;
if (qualifiedName.IsEmpty) { qualifiedName = rootElement.QualifiedName; }
var type = CreateTypeModel(source, rootElement.ElementSchemaType, qualifiedName);
var type = CreateTypeModel(typeSource, rootElement.ElementSchemaType, qualifiedName);
ClassModel derivedClassModel = null;

if (type.RootElementName != null)
Expand All @@ -261,10 +260,12 @@ private void CreateElements(IEnumerable<XmlSchemaElement> elements)
// There is already another global element with this type.
// Need to create an empty derived class.

var elementSource = CodeUtilities.CreateUri(rootElement.SourceUri);

derivedClassModel = new ClassModel(_configuration)
{
Name = _configuration.NamingProvider.RootClassNameFromQualifiedName(rootElement.QualifiedName),
Namespace = CreateNamespaceModel(source, rootElement.QualifiedName)
Namespace = CreateNamespaceModel(elementSource, rootElement.QualifiedName)
};

derivedClassModel.Documentation.AddRange(GetDocumentation(rootElement));
Expand Down

0 comments on commit 7ba7203

Please sign in to comment.