I am making a program that stores information for my applications. There are 4 main things I need in the XML file, the login information (User name and password), Application names and keys, and the owner of the application (who bought it). The program allows the user to enter as many applications and owners as they want and once login information is correct it loads the data. Then on exit all the data saves to a XML file.
My XML file looks like this
<Data>
<Login>
<UserName> (UserName) </UserName>
<Password> (Password </Password>
</Login>
<Applications>
<Name> (Application Name) </Name>
<Key> (Application Key) </Key>
<Name> (Application Name) </Name>
<Key> (Application Key) </Key>
</Applications>
<Owners>
<Name> (Application Owner) </Name>
<Name> (Application Owner) </Name>
</Owners>
</Data>
I can get the login information to work but I am having trouble with the App Names/Keys and Owners. Here is what I have right now:
Code:
Shared Sub LoadData()
ReDim Preserve AppName(AppCount)
ReDim Preserve AppKey(AppCount)
ReDim Preserve Owner(OwnerCount)
'//Create XML reader
Dim DataIn As XmlReader = New XmlTextReader("ProData.xml")
'//Read Application names and keys
Try
'//Pass through Login information, is there an easier way to do this?
DataIn.ReadStartElement()
DataIn.ReadStartElement()
DataIn.ReadString()
DataIn.ReadEndElement()
DataIn.ReadStartElement()
DataIn.ReadString()
DataIn.ReadEndElement()
DataIn.ReadEndElement()
'//Read Application name and key
DataIn.ReadStartElement()
Do Until DataIn.IsStartElement.Equals("Owners")
DataIn.ReadStartElement()
AppName(AppCount) = DataIn.ReadString()
DataIn.ReadEndElement()
DataIn.ReadStartElement()
AppKey(AppCount) = DataIn.ReadString()
DataIn.ReadEndElement()
AppCount += 1
Loop
DataIn.ReadEndElement()
Catch
End Try
'//Read owners
Try
Do While DataIn.IsStartElement()
DataIn.ReadStartElement()
Owner(OwnerCount) = DataIn.ReadString()
DataIn.ReadEndElement()
OwnerCount += 1
Loop
Catch
End Try
DataIn.Close()
End Sub
Once I read all that the only thing I get is one application and no owners. How do I make it read all of the Apps then stop at the end of the Application Element?