From 3dd2e2e00dbe5c6a3c7f794dd3ea7b106038b5e6 Mon Sep 17 00:00:00 2001 From: Frederik Jacobsen Date: Sat, 18 Oct 2025 22:00:24 +0200 Subject: [PATCH] Added path to copy --- XSDVisualiser.Desktop/Views/LeftTreeView.axaml.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) 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); } } }