Skip to content

Commit

Permalink
Allow simpler syntax in namespace mapping files
Browse files Browse the repository at this point in the history
  • Loading branch information
mganss committed Aug 9, 2023
1 parent 4385c6a commit 2ca8bdf
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions XmlSchemaClassGenerator.Console/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ static void Main(string[] args)
{ "h|help", "show this message and exit", v => showHelp = v != null },
{ "n|namespace=", @"map an XML namespace to a C# namespace
Separate XML namespace and C# namespace by '='.
A single value (no '=') is taken as the C# namespace the empty XML namespace is mapped to.
One option must be given for each namespace to be mapped.
A file name may be given by appending a pipe sign (|) followed by a file name (like schema.xsd) to the XML namespace.
If no mapping is found for an XML namespace, a name is generated automatically (may fail).", v => namespaces.Add(v) },
Expand Down Expand Up @@ -269,6 +270,9 @@ private static void ParseNamespaceFiles(List<string> namespaces, List<string> na
{
var parts = line.Split('=');

if (parts.Length == 1)
parts = new[] { string.Empty, parts[0] };

if (parts.Length != 2)
{
System.Console.WriteLine($"{namespaceFile}:{number}: Line format is XML namespace = C# namespace [file name]");
Expand Down

0 comments on commit 2ca8bdf

Please sign in to comment.