Here's an example I just to build some XML:
Code:
Public Shared Function BuildBookInMemory(strRoot As String, strHeader As String, Data As OleDbDataReader) As XmlDocument
	'Create this: 
'            <?xml version="1.0"?>
'            <Library>
'              <Book BookType="ExistsInDB">
'                <ID>1</ID>
'                <Author>Joe</Author>
'                <AuthorID>1</AuthorID>
'                <Comment>Excellent</Comment>
'                <CommentID>1</CommentID>
'                <Read>False</Read>
'                <Title>book 1</Title>
'              </Book>
'            </Library>                  
'            

	Dim r As Integer
	Dim xmlBook As XmlDocument
	Dim xmlDec As XmlDeclaration
	Dim xmlRoot As XmlElement
	Dim xmlFirstNode As XmlElement
	Dim xmlNode As XmlElement
	Dim strNodes As String() = {"ID", "AuthorID", "Author", "CommentID", "Comment", "Read", _
		"Title"}


	xmlBook = New XmlDocument()
	xmlDec = xmlBook.CreateXmlDeclaration("1.0", Nothing, Nothing)
	xmlBook.AppendChild(xmlDec)
	xmlRoot = xmlBook.CreateElement(strRoot)
	xmlBook.AppendChild(xmlRoot)

	xmlFirstNode = xmlBook.CreateElement(strHeader)
	xmlFirstNode.SetAttribute("BookType", "ExistsInDB")
	xmlRoot.AppendChild(xmlFirstNode)
	For r = 0 To 6
		xmlNode = xmlBook.CreateElement(strNodes(r))
		xmlNode.InnerText = Data(r).ToString()
		xmlFirstNode.AppendChild(xmlNode)
	Next

	Return xmlBook
End Function

Public Shared Function BuildBookForDB(strRoot As String, strHeader As String, Book As Books.Book) As XmlDocument
	Dim r As Integer
	Dim xmlBook As XmlDocument
	Dim xmlDec As XmlDeclaration
	Dim xmlRoot As XmlElement
	Dim xmlFirstNode As XmlElement
	Dim xmlNode As XmlElement
	Dim strNodes As String() = {"ID", "AuthorID", "CommentID", "Read", "Title"}


	xmlBook = New XmlDocument()
	xmlDec = xmlBook.CreateXmlDeclaration("1.0", Nothing, Nothing)
	xmlBook.AppendChild(xmlDec)
	xmlRoot = xmlBook.CreateElement(strRoot)
	xmlBook.AppendChild(xmlRoot)

	xmlFirstNode = xmlBook.CreateElement(strHeader)
	xmlFirstNode.SetAttribute("BookType", "ExistsInDB")
	xmlRoot.AppendChild(xmlFirstNode)
	For r = 0 To 3
		xmlNode = xmlBook.CreateElement(strNodes(r))
		Select Case r
			Case 0
				xmlNode.InnerText = Book.ID.ToString()
				Exit Select
			Case 1
				xmlNode.InnerText = Book.AuthorID.ToString()
				Exit Select
			Case 2
				xmlNode.InnerText = Book.CommentID.ToString()
				Exit Select
			Case 3
				xmlNode.InnerText = Book.Read.ToString()
				Exit Select
			Case 4
				xmlNode.InnerText = Book.Title
				Exit Select
		End Select
		xmlFirstNode.AppendChild(xmlNode)
	Next

	Return xmlBook
End Function