diff -U 3 -H -d -r -N -x '*.txt' -x '*.config' -x '*.xml' -x '*.dll' -x '*.pdb' -x '*.cache' -x '*.exe' -x '*.resources' -- XSDDiagram-2018-06-19-1.2-Source-orig/Program.cs XSDDiagram-2018-06-19-1.2-Source/Program.cs
--- XSDDiagram-2018-06-19-1.2-Source-orig/Program.cs	2017-04-13 08:46:40.000000000 +0200
+++ XSDDiagram-2018-06-19-1.2-Source/Program.cs	2019-10-16 14:20:27.187169089 +0200
@@ -35,7 +35,7 @@
 		//static extern bool AllocConsole();
 
 		static string usage = @"XSD Diagram, version {0}
-Usage: {1} [-o output.svg] [-os EXTENSION] [-r RootElement[@namespace]]* [-e N] [-d] [-z N] [-f PATH,NAME,TYPE,NAMESPACE,COMMENT] [-a] [-y] [-u USERNAME] [-p PASSWORD] [file.xsd or URL]
+Usage: {1} [-o output.svg] [-os EXTENSION] [-r RootElement[@namespace]]* [-e N] [-d] [-z N] [-f PATH,NAME,TYPE,NAMESPACE,COMMENT,SEQ,LASTCHILD,XSDTYPE] [-a] [-y] [-u USERNAME] [-p PASSWORD] [file.xsd or URL]
 
 -o FILE
 	specifies the output image. '.png','.jpg', '.svg', '.txt', '.csv' ('.emf' on Windows) are allowed.
@@ -56,7 +56,7 @@
 -z N
 	specifies the zoom percentage from 10% to 1000% (only for .png image).
 	Work only with the '-o', '-os png' or '-os jpg' option.
--f PATH,NAME,TYPE,NAMESPACE,COMMENT
+-f PATH,NAME,TYPE,NAMESPACE,COMMENT,SEQ,LASTCHILD,XSDTYPE
 	specifies the fields you want to output when rendering to a txt or csf file.
 -a
 	outputs the attributes in text mode only (.txt and .csv).
@@ -189,7 +189,11 @@
 				for (int i = 0; i < Options.ExpandLevel; i++)
                 {
 					Log("Expanding to level {0}...\n", i + 1);
-                    diagram.ExpandOneLevel();
+                    if (!diagram.ExpandOneLevel())
+                    {
+                        Log("Cannot expand more.\n");
+                        break;
+                    }
                 }
                 diagram.Layout(graphics);
 				Log("Saving image...\n");
diff -U 3 -H -d -r -N -x '*.txt' -x '*.config' -x '*.xml' -x '*.dll' -x '*.pdb' -x '*.cache' -x '*.exe' -x '*.resources' -- XSDDiagram-2018-06-19-1.2-Source-orig/XSDDiagrams/Rendering/Diagram.cs XSDDiagram-2018-06-19-1.2-Source/XSDDiagrams/Rendering/Diagram.cs
--- XSDDiagram-2018-06-19-1.2-Source-orig/XSDDiagrams/Rendering/Diagram.cs	2018-06-19 15:22:10.000000000 +0200
+++ XSDDiagram-2018-06-19-1.2-Source/XSDDiagrams/Rendering/Diagram.cs	2019-10-16 14:20:27.187169089 +0200
@@ -434,17 +434,19 @@
 			_rootElements.Clear();
 		}
 
-		public void ExpandOneLevel()
+		public bool ExpandOneLevel()
 		{
+            bool result = false;
 			foreach (DiagramItem item in _rootElements)
 			{
-                this.ExpandOneLevel(item);
+                result |= this.ExpandOneLevel(item);
 
                 if (item.HasChildElements && item.ChildElements.Count == 0)
                 {
-                    this.ExpandChildren(item);
+                    result |= this.ExpandChildren(item);
                 }
 			}
+            return result;
 		}
 
 		public void Clear()
@@ -592,11 +594,13 @@
                 (int)Math.Round(rectangle.Height * this.Scale));
 		}
 
-		public void ExpandChildren(DiagramItem parentDiagramElement)
+		public bool ExpandChildren(DiagramItem parentDiagramElement)
 		{
+            bool result = false;
             ClearSearch();
             if (parentDiagramElement.ItemType == DiagramItemType.element || parentDiagramElement.ItemType == DiagramItemType.type)
 			{
+                result = true;
 				DiagramItem diagramElement = parentDiagramElement;
 				if (diagramElement.TabSchema is XMLSchema.element)
 				{
@@ -641,7 +645,8 @@
 			}
 			else if (parentDiagramElement.ItemType == DiagramItemType.group)
 			{
-				DiagramItem diagramCompositors = parentDiagramElement;
+                result = true;
+                DiagramItem diagramCompositors = parentDiagramElement;
 				XMLSchema.group group = diagramCompositors.TabSchema as XMLSchema.group;
 
                 if (group.Items != null)
@@ -683,6 +688,7 @@
                     AddAny(diagramCompositors, null, diagramCompositors.NameSpace);
                 }
 			}
+            return result;
         }
 
         public void SelectElement(DiagramItem element)
@@ -919,18 +925,20 @@
 			}
 		}
 
-        private void ExpandOneLevel(DiagramItem parentItem)
+        private bool ExpandOneLevel(DiagramItem parentItem)
         {
+            bool result = false;
             ClearSearch();
             foreach (DiagramItem item in parentItem.ChildElements)
             {
-                this.ExpandOneLevel(item);
+                result |= this.ExpandOneLevel(item);
 
                 if (item.HasChildElements && item.ChildElements.Count == 0)
                 {
-                    this.ExpandChildren(item);
+                    result |= this.ExpandChildren(item);
                 }
             }
+            return result;
         }
 
         #endregion
diff -U 3 -H -d -r -N -x '*.txt' -x '*.config' -x '*.xml' -x '*.dll' -x '*.pdb' -x '*.cache' -x '*.exe' -x '*.resources' -- XSDDiagram-2018-06-19-1.2-Source-orig/XSDDiagrams/Rendering/DiagramTxtRenderer.cs XSDDiagram-2018-06-19-1.2-Source/XSDDiagrams/Rendering/DiagramTxtRenderer.cs
--- XSDDiagram-2018-06-19-1.2-Source-orig/XSDDiagrams/Rendering/DiagramTxtRenderer.cs	2017-04-13 08:17:32.000000000 +0200
+++ XSDDiagram-2018-06-19-1.2-Source/XSDDiagrams/Rendering/DiagramTxtRenderer.cs	2019-10-16 14:20:27.187169089 +0200
@@ -32,7 +32,7 @@
         private Schema _schema;
 
         private static List<string> fields = new List<string>() {
-            "PATH", "NAME", "TYPE", "NAMESPACE", "COMMENT"
+            "PATH", "NAME", "TYPE", "NAMESPACE", "COMMENT", "SEQ", "LASTCHILD", "XSDTYPE"
         };
 
         #endregion
@@ -53,6 +53,8 @@
 
         #region Public Properties
 
+        public bool iteratingLastChild;
+
         public override string Name
         {
             get
@@ -124,7 +126,7 @@
 
         public override void BeginItemsRender()
         {
-            //PATH,NAME,TYPE,NAMESPACE,COMMENT,ATTRIBUT_NAME,ATTRIBUT_TYPE,ATTRIBUT_COMMENT
+            //PATH,NAME,TYPE,NAMESPACE,COMMENT,SEQ,LASTCHILD,XSDTYPE,ATTRIBUT_NAME,ATTRIBUT_TYPE,ATTRIBUT_COMMENT
             //foreach (string field in _finalTextOutputFields)
             for (int i = 0; i < _finalTextOutputFields.Count; i++)
             {
@@ -157,9 +159,10 @@
                         _finalTextOutputFields.Add(field);
 
             this.BeginItemsRender();
-
+            int c = 0;
             foreach (DiagramItem element in diagram.RootElements)
             {
+                this.iteratingLastChild = diagram.RootElements.Count == ++c;
                 this.Render(element);
             }
 
@@ -180,6 +183,9 @@
             else if (drawingItem.TabSchema is XMLSchema.complexType)
                 type = "complexType";
 
+            string occurences = String.Format("{0}..", drawingItem.MinOccurrence) +
+                    (drawingItem.MaxOccurrence == -1 ? "∞" : string.Format("{0}", drawingItem.MaxOccurrence));
+
             if (type.Length > 0)
             {
                 string path = '/' + drawingItem.Name;
@@ -221,9 +227,34 @@
                     }
                 }
 
+                //bool lastChild = drawingItem.Parent.ChildElements[drawingItem.Parent.ChildElements.Count - 1] == drawingItem;
+
                 // Output the item
+                string t;
+                XMLSchema.element el;
                 for (int i = 0; i < _finalTextOutputFields.Count; i++)
                 {
+                    el = drawingItem.TabSchema as XMLSchema.element;
+                    if (el != null)
+                    {
+                        string et = "" + el.type;
+                        if (et == "")
+                        {
+                            t = "[none]";
+                        }
+                        else
+                        {
+                            t = et.Substring(et.LastIndexOf(':') + 1);
+                            if (t == "")
+                            {
+                                t = "[none]";
+                            }
+                        }
+                    }
+                    else
+                    {
+                        t = "[none]";
+                    }
                     if (i > 0)
                         _writer.Write(_fieldSeparator);
                     string field = _finalTextOutputFields[i];
@@ -234,6 +265,9 @@
                         case "TYPE": _writer.Write(type); break;
                         case "NAMESPACE": _writer.Write(drawingItem.NameSpace); break;
                         case "COMMENT": _writer.Write(comment); break;
+                        case "SEQ": _writer.Write(occurences); break;
+                        case "LASTCHILD": _writer.Write(this.iteratingLastChild ? "1" : "0"); break;
+                        case "XSDTYPE": _writer.Write(t); break;
                     }
                 }
                 _writer.WriteLine();
@@ -270,7 +304,7 @@
                                         case "TYPE": _writer.Write(xsdAttribute.Type); break;
                                         case "NAMESPACE": _writer.Write(xsdAttribute.NameSpace); break;
                                         case "COMMENT": _writer.Write(commentAttribute); break;
-                                    }
+}
                                 }
                                 _writer.WriteLine();
                             }
@@ -328,8 +362,10 @@
             // Draw children expand box
             if (drawingItem.HasChildElements && drawingItem.ShowChildElements)
             {
+                int c = 0;
                 foreach (DiagramItem element in drawingItem.ChildElements)
                 {
+                    this.iteratingLastChild = drawingItem.ChildElements.Count == ++c;
                     this.Render(element);
                     //_writer.WriteLine();
                 }
