From 865b1ba41ebca36535b398c9b037de45660ffd82 Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Tue, 2 Sep 2025 09:45:08 -0700 Subject: [PATCH 01/11] Try to fix output display --- .../VB/source.vb | 32 ++++++++++--------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement Example/VB/source.vb b/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement Example/VB/source.vb index 7d3a4454539..c6dc7e3a2a2 100644 --- a/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement Example/VB/source.vb +++ b/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement Example/VB/source.vb @@ -1,4 +1,3 @@ -' Option Explicit Option Strict @@ -6,16 +5,17 @@ Imports System.IO Imports System.Xml Public Class Sample - Public Shared Sub Main() - 'Create the XmlDocument. + ' + + ' Create the XmlDocument. Dim doc As New XmlDocument() doc.LoadXml("" & _ "Pride And Prejudice" & _ "") - 'Create a new node and add it to the document. - 'The text node is the content of the price element. + ' Create a new node and add it to the document. + ' The text node is the content of the price element. Dim elem As XmlElement = doc.CreateElement("price") Dim text As XmlText = doc.CreateTextNode("19.95") doc.DocumentElement.AppendChild(elem) @@ -23,14 +23,16 @@ Public Class Sample Console.WriteLine("Display the modified XML...") doc.Save(Console.Out) - End Sub + + ' The example displays the following output: + ' + ' Display the modified XML... + ' + ' + ' Pride And Prejudice + ' 19.95 + ' + ' + ' + End Sub End Class -' The example displays the following output: -' -' Display the modified XML... -' -' -' Pride And Prejudice -' 19.95 -' -' From 0a49e98b1df21439cfe581e19c5e7c6fbe98237c Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Tue, 2 Sep 2025 12:14:48 -0700 Subject: [PATCH 02/11] Fix formatting in VB XMLDocument example snippet --- .../VB/source.vb | 1 + 1 file changed, 1 insertion(+) diff --git a/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement Example/VB/source.vb b/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement Example/VB/source.vb index c6dc7e3a2a2..cde4a0d722f 100644 --- a/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement Example/VB/source.vb +++ b/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement Example/VB/source.vb @@ -33,6 +33,7 @@ Public Class Sample ' 19.95 ' ' + ' End Sub End Class From 0324b1e18ee817a7ad893701f2192801d3edeffb Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Tue, 2 Sep 2025 12:43:22 -0700 Subject: [PATCH 03/11] Fix XML comment escaping in VB example --- .../VB/source.vb | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement Example/VB/source.vb b/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement Example/VB/source.vb index cde4a0d722f..b3994e87a6a 100644 --- a/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement Example/VB/source.vb +++ b/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement Example/VB/source.vb @@ -27,12 +27,11 @@ Public Class Sample ' The example displays the following output: ' ' Display the modified XML... - ' - ' - ' Pride And Prejudice - ' 19.95 - ' - ' + ' \ + ' \ + ' \Pride And Prejudice\ + ' \19.95\ + ' \ ' End Sub From 8839ebdb5e4f27fc35567a4cabd7357eb05651ea Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Tue, 2 Sep 2025 16:38:27 -0700 Subject: [PATCH 04/11] Try ::: code snippets --- xml/System.Xml/XmlDocument.xml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/xml/System.Xml/XmlDocument.xml b/xml/System.Xml/XmlDocument.xml index 7810a8d92f8..fffb5c55b03 100644 --- a/xml/System.Xml/XmlDocument.xml +++ b/xml/System.Xml/XmlDocument.xml @@ -1986,21 +1986,22 @@ The following example adds significant white space to the document. The text for the Text node. Creates an with the specified text. - The new node. + The new node. From 431ca6213f967af553e6b868a4e67f5cead4d689 Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Tue, 2 Sep 2025 17:05:39 -0700 Subject: [PATCH 05/11] Remove commented XML output Removed commented output example from the code. --- .../VB/source.vb | 9 --------- 1 file changed, 9 deletions(-) diff --git a/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement Example/VB/source.vb b/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement Example/VB/source.vb index b3994e87a6a..eb454a8ca6c 100644 --- a/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement Example/VB/source.vb +++ b/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement Example/VB/source.vb @@ -24,15 +24,6 @@ Public Class Sample Console.WriteLine("Display the modified XML...") doc.Save(Console.Out) - ' The example displays the following output: - ' - ' Display the modified XML... - ' \ - ' \ - ' \Pride And Prejudice\ - ' \19.95\ - ' \ - ' End Sub End Class From f3bc908592ebd2f0c3bb6c694646031d3f4472a5 Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Wed, 3 Sep 2025 12:19:21 -0700 Subject: [PATCH 06/11] Move snippet tags --- .../VB/source.vb | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement Example/VB/source.vb b/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement Example/VB/source.vb index eb454a8ca6c..c016cdc74eb 100644 --- a/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement Example/VB/source.vb +++ b/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement Example/VB/source.vb @@ -1,12 +1,11 @@ Option Explicit Option Strict - +' Imports System.IO Imports System.Xml Public Class Sample Public Shared Sub Main() - ' ' Create the XmlDocument. Dim doc As New XmlDocument() @@ -24,6 +23,16 @@ Public Class Sample Console.WriteLine("Display the modified XML...") doc.Save(Console.Out) - ' End Sub End Class + +' The example displays the following output: +' +' Display the modified XML... +' +' +' Pride And Prejudice +' 19.95 +' + +' From e4e1a0d7043a8fb62de43ef5530f300724cbf3ac Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Wed, 3 Sep 2025 12:40:14 -0700 Subject: [PATCH 07/11] Try escape book tag --- .../VB/source.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement Example/VB/source.vb b/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement Example/VB/source.vb index c016cdc74eb..8b04e41728d 100644 --- a/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement Example/VB/source.vb +++ b/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement Example/VB/source.vb @@ -33,6 +33,6 @@ End Class ' ' Pride And Prejudice ' 19.95 -' +' \ ' From 292b0bef160c99f3fedbed3e5c6c478678460e9d Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Wed, 24 Sep 2025 13:26:29 -0700 Subject: [PATCH 08/11] fix it properly --- .../XmlDocument/CreateElement/project.csproj | 8 +++++++ .../XmlDocument/CreateElement/source.cs | 23 +++++-------------- .../XmlDocument/CreateElement/source1.cs | 12 +++++----- .../VB/source.vb | 16 +++---------- xml/System.Xml/XmlDocument.xml | 15 +++++++++++- 5 files changed, 37 insertions(+), 37 deletions(-) create mode 100644 snippets/csharp/System.Xml/XmlDocument/CreateElement/project.csproj diff --git a/snippets/csharp/System.Xml/XmlDocument/CreateElement/project.csproj b/snippets/csharp/System.Xml/XmlDocument/CreateElement/project.csproj new file mode 100644 index 00000000000..fc3f09ab482 --- /dev/null +++ b/snippets/csharp/System.Xml/XmlDocument/CreateElement/project.csproj @@ -0,0 +1,8 @@ + + + + Library + net9.0 + + + diff --git a/snippets/csharp/System.Xml/XmlDocument/CreateElement/source.cs b/snippets/csharp/System.Xml/XmlDocument/CreateElement/source.cs index d27cfe01c1a..a02b0c2a98f 100644 --- a/snippets/csharp/System.Xml/XmlDocument/CreateElement/source.cs +++ b/snippets/csharp/System.Xml/XmlDocument/CreateElement/source.cs @@ -1,20 +1,19 @@ // using System; -using System.IO; using System.Xml; public class Sample { - public static void Main() + public static void CreateTextNodeExample() { - //Create the XmlDocument. - XmlDocument doc = new XmlDocument(); + // Create the XmlDocument. + XmlDocument doc = new(); doc.LoadXml("" + "Pride And Prejudice" + ""); - //Create a new node and add it to the document. - //The text node is the content of the price element. + // Create a new node and add it to the document. + // The text node is the content of the price element. XmlElement elem = doc.CreateElement("price"); XmlText text = doc.CreateTextNode("19.95"); doc.DocumentElement.AppendChild(elem); @@ -24,14 +23,4 @@ public static void Main() doc.Save(Console.Out); } } -/* - The example displays the following output: - - Display the modified XML... - - - Pride And Prejudice - 19.95 - -*/ - // +// diff --git a/snippets/csharp/System.Xml/XmlDocument/CreateElement/source1.cs b/snippets/csharp/System.Xml/XmlDocument/CreateElement/source1.cs index 63e9b82ba49..b38ef398686 100644 --- a/snippets/csharp/System.Xml/XmlDocument/CreateElement/source1.cs +++ b/snippets/csharp/System.Xml/XmlDocument/CreateElement/source1.cs @@ -3,12 +3,12 @@ using System.IO; using System.Xml; -public class Sample { - - public static void Main() { - +public class Sample1 +{ + public static void CreateElementExample() + { // Create the XmlDocument. - XmlDocument doc = new XmlDocument(); + XmlDocument doc = new(); string xmlData = ""; doc.Load(new StringReader(xmlData)); @@ -22,4 +22,4 @@ public static void Main() { doc.Save(Console.Out); } } - // +// diff --git a/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement Example/VB/source.vb b/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement Example/VB/source.vb index 8b04e41728d..cbd84431153 100644 --- a/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement Example/VB/source.vb +++ b/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement Example/VB/source.vb @@ -6,7 +6,7 @@ Imports System.Xml Public Class Sample Public Shared Sub Main() - + ' Create the XmlDocument. Dim doc As New XmlDocument() doc.LoadXml("" & _ @@ -22,17 +22,7 @@ Public Class Sample Console.WriteLine("Display the modified XML...") doc.Save(Console.Out) - - End Sub -End Class - -' The example displays the following output: -' -' Display the modified XML... -' -' -' Pride And Prejudice -' 19.95 -' \ + End Sub +End Class ' diff --git a/xml/System.Xml/XmlDocument.xml b/xml/System.Xml/XmlDocument.xml index fffb5c55b03..73b6f700900 100644 --- a/xml/System.Xml/XmlDocument.xml +++ b/xml/System.Xml/XmlDocument.xml @@ -1029,6 +1029,19 @@ The following example creates a new element and adds it to the document. [!code-csharp[Classic WebData XmlDocument.CreateElement Example#1](~/snippets/csharp/System.Xml/XmlDocument/CreateElement/source.cs#1)] [!code-vb[Classic WebData XmlDocument.CreateElement Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement Example/VB/source.vb#1)] +The example produces the following output: + +```output +' The example displays the following output: +' +' Display the modified XML... +' +' +' Pride And Prejudice +' 19.95 +' +``` + ]]> @@ -1991,7 +2004,7 @@ The following example adds significant white space to the document. Date: Wed, 24 Sep 2025 13:27:59 -0700 Subject: [PATCH 09/11] remove comment syntax --- xml/System.Xml/XmlDocument.xml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/xml/System.Xml/XmlDocument.xml b/xml/System.Xml/XmlDocument.xml index 73b6f700900..1cdfa4216ca 100644 --- a/xml/System.Xml/XmlDocument.xml +++ b/xml/System.Xml/XmlDocument.xml @@ -1032,14 +1032,14 @@ The following example creates a new element and adds it to the document. The example produces the following output: ```output -' The example displays the following output: -' -' Display the modified XML... -' -' -' Pride And Prejudice -' 19.95 -' +The example displays the following output: + +Display the modified XML... + + + Pride And Prejudice + 19.95 + ``` ]]> From ec95a3a5bdd53666874bd180681395725c98486e Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Wed, 24 Sep 2025 13:28:51 -0700 Subject: [PATCH 10/11] ack --- xml/System.Xml/XmlDocument.xml | 2 -- 1 file changed, 2 deletions(-) diff --git a/xml/System.Xml/XmlDocument.xml b/xml/System.Xml/XmlDocument.xml index 1cdfa4216ca..14c9f42933b 100644 --- a/xml/System.Xml/XmlDocument.xml +++ b/xml/System.Xml/XmlDocument.xml @@ -1032,8 +1032,6 @@ The following example creates a new element and adds it to the document. The example produces the following output: ```output -The example displays the following output: - Display the modified XML... From 21d5c9511bf8c7a6d1b98bfd6b9a0b6f8b6b0437 Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Wed, 24 Sep 2025 13:37:17 -0700 Subject: [PATCH 11/11] add project file --- .../VB/project.vbproj | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement Example/VB/project.vbproj diff --git a/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement Example/VB/project.vbproj b/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement Example/VB/project.vbproj new file mode 100644 index 00000000000..92e46ddaccf --- /dev/null +++ b/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement Example/VB/project.vbproj @@ -0,0 +1,8 @@ + + + + Exe + net9.0 + + +