VERSION 5.00
Begin VB.Form frmSample 
   Caption         =   "Sample Application"
   ClientHeight    =   1245
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   3930
   LinkTopic       =   "Form1"
   ScaleHeight     =   1245
   ScaleWidth      =   3930
   StartUpPosition =   3  'Windows Default
End
Attribute VB_Name = "frmSample"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Public Sub TestWrite()
    Dim oBS As BookStoreLib.Bookstore
    Dim oBook As BookStoreLib.BookType
    Dim oDt As LtXmlComLib14.DateTime
    Dim strXml As String
    
    ' to create the XML document from scratch
    Set oBS = New BookStoreLib.Bookstore
    Set oBook = oBS.Book.AddNew
    
    oBook.Title = "The Autobiography of Benjamin Franklin"
    oBook.Price = 8.99
    oDt = New LtXmlComLib14.DateTime
    oDt.SetDate 1981, 5, 11
    Set oBook.Publicationdate = oDt
    oBook.ISBN = "1-861003-11-0"
    oBook.Author.First_name = "Benjamin"
    oBook.Author.Last_name = "Franklin"
    oBook.Genre = "autobiography"
    strXml = oBS.ToXml
    Debug.Print strXml
End Sub

Public Sub TestRead()
    Dim oBS As BookStoreLib.Bookstore
    Dim oBook As BookStoreLib.BookType
    
    ' to create the XML document from scratch
    Set oBS = New BookStoreLib.Bookstore
    oBS.FromXmlFile "..\..\..\BookStoreSample.xml"
    
    For Each oBook In oBS.Book
        Debug.Print "Book Title           " & oBook.Title
        Debug.Print "    Price            " & oBook.Price
        Debug.Print "    Author           " & oBook.Author.First_name & " " & oBook.Author.Last_name
        If oBook.IsValidPublicationdate Then
            Debug.Print "    Publicationdate  " & oBook.Publicationdate.ToString("s")
        Else
            Debug.Print "    Publicationdate  Not Listed"
        End If
        If oBook.IsValidISBN Then
            Debug.Print "    ISBN             " & oBook.ISBN
        Else
            Debug.Print "    ISBN             Not Listed"
        End If
        If oBook.IsValidGenre Then
            Debug.Print "    Genre            " & oBook.Genre
        Else
            Debug.Print "    Genre            Not Listed"
        End If
    Next oBook
End Sub


Private Sub Form_Load()
    TestWrite
    TestRead
End Sub