Skip to content

Commit 7dc0ebf

Browse files
author
Michael Ganss
committed
Change namespace mapping file format
1 parent bdd895e commit 7dc0ebf

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

XmlSchemaClassGenerator.Console/Program.cs

+8-7
Original file line numberDiff line numberDiff line change
@@ -243,18 +243,19 @@ private static void ParseNamespaceFiles(List<string> namespaces, List<string> na
243243
.Select((l, i) => (Line: l.Trim(), Number: i + 1))
244244
.Where(l => !string.IsNullOrWhiteSpace(l.Line) && !l.Line.StartsWith("#")))
245245
{
246-
var parts = line.Split();
246+
var parts = line.Split('=');
247247

248-
if (parts.Length < 2 || parts.Length > 3)
248+
if (parts.Length != 2)
249249
{
250-
System.Console.WriteLine($"{namespaceFile}:{number}: Must contain XML namespace, C# namespace, and optionally filename, separated by whitespace");
250+
System.Console.WriteLine($"{namespaceFile}:{number}: Line format is XML namespace = C# namespace [file name]");
251251
Environment.Exit(1);
252252
}
253253

254-
var ns = $"{parts[0]}={parts[1]}";
255-
256-
if (parts.Length == 3)
257-
ns += $"={parts[2]}";
254+
var xmlns = parts[0].Trim();
255+
var parts2 = parts[1].Trim().Split();
256+
var csns = parts2[0];
257+
var source = parts2.Length > 1 ? $"|{parts2[1].Trim()}" : string.Empty;
258+
var ns = $"{xmlns}{source}={csns}";
258259

259260
namespaces.Add(ns);
260261
}

0 commit comments

Comments
 (0)