diff --git a/XSDVisualiser.Desktop/Views/LeftTreeView.axaml.cs b/XSDVisualiser.Desktop/Views/LeftTreeView.axaml.cs index 06e4a03..ec07aa5 100644 --- a/XSDVisualiser.Desktop/Views/LeftTreeView.axaml.cs +++ b/XSDVisualiser.Desktop/Views/LeftTreeView.axaml.cs @@ -37,12 +37,13 @@ namespace XSDVisualiser.Desktop.Views { var sb = new StringBuilder(); // Header - sb.AppendLine("Depth\tName\tNamespace\tTypeName\tBuiltInType\tMinOccurs\tMaxOccurs\tContentModel\tIsNillable"); - AppendNode(sb, root, 0); + sb.AppendLine("Depth\tPath\tName\tNamespace\tTypeName\tBuiltInType\tMinOccurs\tMaxOccurs\tContentModel\tIsNillable"); + var initialPath = root.Name ?? string.Empty; + AppendNode(sb, root, 0, initialPath); return sb.ToString(); } - private static void AppendNode(StringBuilder sb, SchemaNode node, int depth) + private static void AppendNode(StringBuilder sb, SchemaNode node, int depth, string path) { string San(string? s) { @@ -60,6 +61,7 @@ namespace XSDVisualiser.Desktop.Views var line = string.Join("\t", new[] { depth.ToString(CultureInfo.InvariantCulture), + San(path), San(node.Name), San(node.Namespace), San(node.TypeName), @@ -75,7 +77,9 @@ namespace XSDVisualiser.Desktop.Views { foreach (var child in node.Children) { - AppendNode(sb, child, depth + 1); + var nextPathSegment = child.Name ?? string.Empty; + var childPath = string.IsNullOrEmpty(San(path)) ? nextPathSegment : $"{path}/{nextPathSegment}"; + AppendNode(sb, child, depth + 1, childPath); } } }