reading writing XML

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • metalheadstorm
    New Member
    • Sep 2007
    • 84

    reading writing XML

    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:

    <Operations>
    <Values>
    <Operationid>12 345</Operationid>
    <LastName>Dl</LastName>
    <Street>Copr Op</Street>
    <City>Bugsville </City>
    <State>CO</State>
    <Zip>80276</Zip>
    </Values>
    </Operations>

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


    This is my code for reading the XML doc


    [CODE=Vb] Private m_AppPath As String
    Private Sub Command1_Click( )
    Call LoadValues
    End Sub
    Private Sub LoadValues()
    Dim xml_document As DOMDocument
    Dim values_node As IXMLDOMNode
    ' Load the document.
    Set xml_document = New DOMDocument
    xml_document.Lo ad m_AppPath & "Values.xml "
    ' If the file doesn't exist, then
    ' xml_document.do cumentElement is Nothing.
    If xml_document.do cumentElement Is Nothing Then
    ' The file doesn't exist. Do nothing.
    Exit Sub
    End If
    ' Find the Values section.
    Set values_node = xml_document.se lectSingleNode( "Operations ")
    ' Read the saved values.
    txtFirstName.Te xt = GetNodeValue(va lues_node, "Operationi d", "???")
    txtLastName.Tex t = GetNodeValue(va lues_node, "LastName", "???")
    txtStreet.Text = GetNodeValue(va lues_node, "Street", "???")
    txtCity.Text = GetNodeValue(va lues_node, "City", "???")
    txtState.Text = GetNodeValue(va lues_node, "State", "???")
    txtZip.Text = GetNodeValue(va lues_node, "Zip", "???")
    End Sub

    ' Return the node's value.
    Private Function GetNodeValue(By Val start_at_node As IXMLDOMNode, ByVal node_name As String, Optional ByVal default_value As String = "") As String
    Dim value_node As IXMLDOMNode
    Set value_node = start_at_node.s electSingleNode (".//" & node_name)
    If value_node Is Nothing Then
    GetNodeValue = default_value
    Else
    GetNodeValue = value_node.Text
    End If
    End Function
    [/CODE]


    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
  • metalheadstorm
    New Member
    • Sep 2007
    • 84

    #2
    hello ? :D the forum seems to be dead

    Comment

    Working...