By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,345 Members | 2,404 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,345 IT Pros & Developers. It's quick & easy.

reading writing XML

P: 84
ok i have a prgram im developing and it currently is using a MSAcess backend to hold all the data for it, which is working fine. But now i would like to switch over to using XMl to sort my data as to read the data currently u need MSAccess..which not everone has.

so i have a small xml doc:

<Street>Copr Op</Street>

(dont wory about the names that 'template' was taken from an example)

This is my code for reading the XML doc

Expand|Select|Wrap|Line Numbers
  1.  Private m_AppPath As String 
  2. Private Sub Command1_Click()
  3. Call LoadValues
  4. End Sub
  5. Private Sub LoadValues()
  6. Dim xml_document As DOMDocument
  7. Dim values_node As IXMLDOMNode
  8. ' Load the document.
  9. Set xml_document = New DOMDocument
  10. xml_document.Load m_AppPath & "Values.xml"
  11. ' If the file doesn't exist, then
  12. ' xml_document.documentElement is Nothing.
  13. If xml_document.documentElement Is Nothing Then
  14. ' The file doesn't exist. Do nothing.
  15. Exit Sub
  16. End If
  17. ' Find the Values section.
  18. Set values_node = xml_document.selectSingleNode("Operations")
  19. ' Read the saved values.
  20. txtFirstName.Text = GetNodeValue(values_node, "Operationid", "???")
  21. txtLastName.Text = GetNodeValue(values_node, "LastName", "???")
  22. txtStreet.Text = GetNodeValue(values_node, "Street", "???")
  23. txtCity.Text = GetNodeValue(values_node, "City", "???")
  24. txtState.Text = GetNodeValue(values_node, "State", "???")
  25. txtZip.Text = GetNodeValue(values_node, "Zip", "???")
  26. End Sub
  28. ' Return the node's value.
  29. Private Function GetNodeValue(ByVal start_at_node As IXMLDOMNode, ByVal node_name As String, Optional ByVal default_value As String = "") As String
  30. Dim value_node As IXMLDOMNode
  31. Set value_node = start_at_node.selectSingleNode(".//" & node_name)
  32. If value_node Is Nothing Then
  33. GetNodeValue = default_value
  34. Else
  35. GetNodeValue = value_node.Text
  36. End If
  37. End Function

this works fine but how do i search by an operationid?

i also found an example that retrieves data from an online location via a log in
i would like to be able to give a user, a username and password and have them able to retrieve data from there own xml sheet online.

heres the download to that example

the coments are in italian i think so i cant understand them.

(that example also has MD5 encryption in it, which i dont need/want)

i hope this makes sence :D

oh ye im using vb6
Jun 24 '08 #1
Share this Question
Share on Google+
1 Reply

P: 84
hello ? :D the forum seems to be dead
Jun 25 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.