Skip to content

Commit 87019da

Browse files
Merge pull request #11751 from dotnet/main
Merge main into live
2 parents d5a21e1 + 59d0db1 commit 87019da

File tree

1 file changed

+11
-3
lines changed
  • snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement Example/VB

1 file changed

+11
-3
lines changed

snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement Example/VB/source.vb

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,31 @@ Imports System.IO
66
Imports System.Xml
77

88
Public Class Sample
9-
9+
1010
Public Shared Sub Main()
1111
'Create the XmlDocument.
1212
Dim doc As New XmlDocument()
1313
doc.LoadXml("<book genre='novel' ISBN='1-861001-57-5'>" & _
1414
"<title>Pride And Prejudice</title>" & _
1515
"</book>")
16-
16+
1717
'Create a new node and add it to the document.
1818
'The text node is the content of the price element.
1919
Dim elem As XmlElement = doc.CreateElement("price")
2020
Dim text As XmlText = doc.CreateTextNode("19.95")
2121
doc.DocumentElement.AppendChild(elem)
2222
doc.DocumentElement.LastChild.AppendChild(text)
23-
23+
2424
Console.WriteLine("Display the modified XML...")
2525
doc.Save(Console.Out)
2626
End Sub
2727
End Class
28+
' The example displays the following output:
29+
'
30+
' Display the modified XML...
31+
' <?xml version="1.0" encoding="utf-8"?>
32+
' <book genre="novel" ISBN="1-861001-57-5">
33+
' <title>Pride And Prejudice</title>
34+
' <price>19.95</price>
35+
' </book>
2836
' </Snippet1>

0 commit comments

Comments
 (0)