forked from dotnet/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsource.vb
31 lines (25 loc) · 938 Bytes
/
source.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
' <Snippet1>
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()
doc.LoadXml("<bookstore>" & _
"<book genre='novel' ISBN='1-861001-57-5'>" & _
"<title>Pride And Prejudice</title>" & _
"</book>" & _
"</bookstore>")
'Create another XmlDocument which holds a list of books.
Dim doc2 As New XmlDocument()
doc2.Load("books.xml")
'Import the last book node from doc2 into the original document.
Dim newBook As XmlNode = doc.ImportNode(doc2.DocumentElement.LastChild, True)
doc.DocumentElement.AppendChild(newBook)
Console.WriteLine("Display the modified XML...")
doc.Save(Console.Out)
End Sub
End Class
' </Snippet1>