Listing C—Form2.cmdOK_Click
Private Sub cmdOK_Click()
  
    Dim nod As MSXML2.IXMLDOMNode
    Dim varResult As MSXML2.IXMLDOMParseError
  
    'Traverse the child nodes of the book element
    'setting the text elements to the appropriate values.
    'Remember that the text contained in an element
    'is considered to be a seperate child node of that
    'element
    Set nod = BookNode.firstChild
    nod.firstChild.nodeValue = txtAuthor.Text
    Set nod = nod.nextSibling
    nod.firstChild.nodeValue = txtTitle.Text
    Set nod = nod.nextSibling
    nod.firstChild.nodeValue = txtGenre.Text
    Set nod = nod.nextSibling
    nod.firstChild.nodeValue = txtPrice.Text
    Set nod = nod.nextSibling
    nod.firstChild.nodeValue = txtPub.Text
    Set nod = nod.nextSibling
    nod.firstChild.nodeValue = txtDesc.Text
              
End Sub